2014-12-13 17:43:02 +01:00
|
|
|
#pragma once
|
2014-12-13 17:48:02 +01:00
|
|
|
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODESTORE_H_
|
|
|
|
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATANODESTORE_H_
|
2014-12-13 17:43:02 +01:00
|
|
|
|
|
|
|
#include <memory>
|
2015-02-17 00:40:34 +01:00
|
|
|
#include "messmer/cpp-utils/macros.h"
|
2014-12-13 17:43:02 +01:00
|
|
|
|
|
|
|
namespace blockstore{
|
|
|
|
class Block;
|
|
|
|
class BlockStore;
|
|
|
|
class Key;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace blobstore {
|
|
|
|
namespace onblocks {
|
2014-12-13 19:17:08 +01:00
|
|
|
namespace datanodestore {
|
2014-12-13 17:43:02 +01:00
|
|
|
class DataNode;
|
2014-12-13 17:58:11 +01:00
|
|
|
class DataLeafNode;
|
|
|
|
class DataInnerNode;
|
2014-12-13 17:43:02 +01:00
|
|
|
|
|
|
|
class DataNodeStore {
|
|
|
|
public:
|
|
|
|
DataNodeStore(std::unique_ptr<blockstore::BlockStore> blockstore);
|
|
|
|
virtual ~DataNodeStore();
|
|
|
|
|
|
|
|
static constexpr uint8_t MAX_DEPTH = 10;
|
|
|
|
|
|
|
|
std::unique_ptr<DataNode> load(const blockstore::Key &key);
|
|
|
|
|
2014-12-13 17:58:11 +01:00
|
|
|
std::unique_ptr<DataLeafNode> createNewLeafNode();
|
|
|
|
std::unique_ptr<DataInnerNode> createNewInnerNode(const DataNode &first_child);
|
2014-12-13 17:43:02 +01:00
|
|
|
|
2015-01-24 01:59:42 +01:00
|
|
|
std::unique_ptr<DataNode> createNewNodeAsCopyFrom(const DataNode &source);
|
|
|
|
|
2015-02-22 19:30:42 +01:00
|
|
|
std::unique_ptr<DataNode> overwriteNodeWith(std::unique_ptr<DataNode> target, const DataNode &source);
|
|
|
|
|
|
|
|
void remove(std::unique_ptr<DataNode> node);
|
|
|
|
|
2014-12-13 17:43:02 +01:00
|
|
|
private:
|
2015-01-24 22:27:14 +01:00
|
|
|
std::unique_ptr<DataNode> load(std::unique_ptr<blockstore::Block> block);
|
2014-12-13 17:43:02 +01:00
|
|
|
|
|
|
|
std::unique_ptr<blockstore::BlockStore> _blockstore;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DataNodeStore);
|
|
|
|
};
|
|
|
|
|
2014-12-13 19:17:08 +01:00
|
|
|
}
|
2014-12-13 17:43:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|