2014-12-09 17:19:59 +01:00
|
|
|
#pragma once
|
2015-10-15 13:09:21 +02:00
|
|
|
#ifndef MESSMER_BLOCKSTORE_IMPLEMENTATIONS_ONDISK_ONDISKBLOCKSTORE_H_
|
|
|
|
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_ONDISK_ONDISKBLOCKSTORE_H_
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
#include <boost/filesystem.hpp>
|
2015-03-12 14:27:51 +01:00
|
|
|
#include "../../interface/helpers/BlockStoreWithRandomKeys.h"
|
2014-12-09 17:19:59 +01:00
|
|
|
|
2015-02-17 00:23:33 +01:00
|
|
|
#include "messmer/cpp-utils/macros.h"
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
namespace ondisk {
|
|
|
|
|
2015-11-27 14:06:40 +01:00
|
|
|
class OnDiskBlockStore final: public BlockStoreWithRandomKeys {
|
2014-12-09 17:19:59 +01:00
|
|
|
public:
|
2015-04-27 18:20:51 +02:00
|
|
|
explicit OnDiskBlockStore(const boost::filesystem::path &rootdir);
|
2014-12-09 17:19:59 +01:00
|
|
|
|
2015-07-20 18:57:48 +02:00
|
|
|
boost::optional<cpputils::unique_ref<Block>> tryCreate(const Key &key, cpputils::Data data) override;
|
2015-07-21 14:50:52 +02:00
|
|
|
boost::optional<cpputils::unique_ref<Block>> load(const Key &key) override;
|
|
|
|
void remove(cpputils::unique_ref<Block> block) override;
|
2015-02-23 21:07:07 +01:00
|
|
|
uint64_t numBlocks() const override;
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
const boost::filesystem::path _rootdir;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(OnDiskBlockStore);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|