2014-12-09 17:19:59 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef FSPP_BLOCKSTORE_BLOCKSTORE_H_
|
|
|
|
#define FSPP_BLOCKSTORE_BLOCKSTORE_H_
|
|
|
|
|
2015-02-17 00:23:33 +01:00
|
|
|
#include <messmer/blockstore/interface/Block.h>
|
2014-12-09 17:19:59 +01:00
|
|
|
#include <string>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
|
|
|
|
//TODO Don't use string, but own class for keys? (better performance for all keys have same length)
|
|
|
|
|
|
|
|
class BlockStore {
|
|
|
|
public:
|
|
|
|
virtual ~BlockStore() {}
|
|
|
|
|
2015-01-24 22:27:14 +01:00
|
|
|
virtual std::unique_ptr<Block> create(size_t size) = 0;
|
2014-12-09 17:19:59 +01:00
|
|
|
//TODO Use boost::optional (if key doesn't exist)
|
|
|
|
// Return nullptr if block with this key doesn't exists
|
2014-12-09 20:36:32 +01:00
|
|
|
virtual std::unique_ptr<Block> load(const Key &key) = 0;
|
2015-02-22 16:53:49 +01:00
|
|
|
virtual void remove(std::unique_ptr<Block> block) = 0;
|
2014-12-09 17:19:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|