2014-12-09 17:19:59 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef FSPP_BLOCKSTORE_BLOCKSTORE_H_
|
|
|
|
#define FSPP_BLOCKSTORE_BLOCKSTORE_H_
|
|
|
|
|
2015-03-12 14:27:51 +01:00
|
|
|
#include "Block.h"
|
2014-12-09 17:19:59 +01:00
|
|
|
#include <string>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
|
|
|
|
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;
|
2015-02-23 21:07:07 +01:00
|
|
|
virtual uint64_t numBlocks() const = 0;
|
2014-12-09 17:19:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|