From 90c49dabc6f621f53e502f5399bbe96563d80483 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 5 Dec 2014 04:50:50 +0100 Subject: [PATCH] Written first version of the blobstore interface --- src/blobstore/interface/Blob.h | 18 +++++++++++++ src/blobstore/interface/BlobStore.h | 25 +++++++++++++++++++ .../blobstore/interface/BlobStoreTest.cpp | 4 +++ src/test/blobstore/interface/BlobTest.cpp | 4 +++ 4 files changed, 51 insertions(+) create mode 100644 src/blobstore/interface/Blob.h create mode 100644 src/blobstore/interface/BlobStore.h create mode 100644 src/test/blobstore/interface/BlobStoreTest.cpp create mode 100644 src/test/blobstore/interface/BlobTest.cpp diff --git a/src/blobstore/interface/Blob.h b/src/blobstore/interface/Blob.h new file mode 100644 index 00000000..fc8c5803 --- /dev/null +++ b/src/blobstore/interface/Blob.h @@ -0,0 +1,18 @@ +#pragma once +#ifndef BLOBSTORE_INTERFACE_BLOB_H_ +#define BLOBSTORE_INTERFACE_BLOB_H_ + +namespace blobstore { + +class Blob { +public: + virtual ~Blob() {} + + virtual void *data() = 0; + virtual const void *data() const = 0; +}; + +} + + +#endif diff --git a/src/blobstore/interface/BlobStore.h b/src/blobstore/interface/BlobStore.h new file mode 100644 index 00000000..95269f29 --- /dev/null +++ b/src/blobstore/interface/BlobStore.h @@ -0,0 +1,25 @@ +#pragma once +#ifndef FSPP_BLOBSTORE_BLOBSTORE_H_ +#define FSPP_BLOBSTORE_BLOBSTORE_H_ + +#include +#include + +namespace blobstore { +class Blob; + +//TODO Don't use string, but own class for keys? (better performance for all keys have same length) + +class BlobStore { +public: + virtual ~BlobStore() {} + + virtual std::unique_ptr create(const std::string &key) = 0; + virtual std::unique_ptr load(const std::string &key) = 0; + //TODO Needed for performance? Or is deleting loaded blobs enough? + //virtual void remove(const std::string &key) = 0; +}; + +} + +#endif diff --git a/src/test/blobstore/interface/BlobStoreTest.cpp b/src/test/blobstore/interface/BlobStoreTest.cpp new file mode 100644 index 00000000..df4e30c9 --- /dev/null +++ b/src/test/blobstore/interface/BlobStoreTest.cpp @@ -0,0 +1,4 @@ +/* + * Tests that the header can be included without needing additional header includes as dependencies. + */ +#include "blobstore/interface/BlobStore.h" diff --git a/src/test/blobstore/interface/BlobTest.cpp b/src/test/blobstore/interface/BlobTest.cpp new file mode 100644 index 00000000..ab79673c --- /dev/null +++ b/src/test/blobstore/interface/BlobTest.cpp @@ -0,0 +1,4 @@ +/* + * Tests that the header can be included without needing additional header includes as dependencies. + */ +#include "blobstore/interface/Blob.h"