Written first version of the blobstore interface
This commit is contained in:
parent
47a35c94b4
commit
90c49dabc6
18
src/blobstore/interface/Blob.h
Normal file
18
src/blobstore/interface/Blob.h
Normal file
@ -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
|
25
src/blobstore/interface/BlobStore.h
Normal file
25
src/blobstore/interface/BlobStore.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#ifndef FSPP_BLOBSTORE_BLOBSTORE_H_
|
||||
#define FSPP_BLOBSTORE_BLOBSTORE_H_
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
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<Blob> create(const std::string &key) = 0;
|
||||
virtual std::unique_ptr<Blob> 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
|
4
src/test/blobstore/interface/BlobStoreTest.cpp
Normal file
4
src/test/blobstore/interface/BlobStoreTest.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
/*
|
||||
* Tests that the header can be included without needing additional header includes as dependencies.
|
||||
*/
|
||||
#include "blobstore/interface/BlobStore.h"
|
4
src/test/blobstore/interface/BlobTest.cpp
Normal file
4
src/test/blobstore/interface/BlobTest.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
/*
|
||||
* Tests that the header can be included without needing additional header includes as dependencies.
|
||||
*/
|
||||
#include "blobstore/interface/Blob.h"
|
Loading…
Reference in New Issue
Block a user