2015-01-23 04:39:36 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREE_H_
|
|
|
|
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREE_H_
|
|
|
|
|
|
|
|
#include <memory>
|
2015-02-17 00:40:34 +01:00
|
|
|
#include "messmer/cpp-utils/macros.h"
|
2015-01-26 00:38:06 +01:00
|
|
|
#include "impl/GetLowestRightBorderNodeWithLessThanKChildrenOrNull.h"
|
2015-01-23 04:39:36 +01:00
|
|
|
|
2015-01-27 00:54:25 +01:00
|
|
|
namespace blockstore {
|
|
|
|
class Key;
|
|
|
|
}
|
2015-01-23 04:39:36 +01:00
|
|
|
namespace blobstore {
|
|
|
|
namespace onblocks {
|
|
|
|
namespace datanodestore {
|
|
|
|
class DataNodeStore;
|
|
|
|
class DataInnerNode;
|
|
|
|
class DataLeafNode;
|
|
|
|
class DataNode;
|
|
|
|
}
|
|
|
|
namespace datatreestore {
|
|
|
|
|
|
|
|
class DataTree {
|
|
|
|
public:
|
|
|
|
DataTree(datanodestore::DataNodeStore *nodeStore, std::unique_ptr<datanodestore::DataNode> rootNode);
|
|
|
|
virtual ~DataTree();
|
|
|
|
|
2015-01-23 18:32:26 +01:00
|
|
|
std::unique_ptr<datanodestore::DataLeafNode> addDataLeaf();
|
2015-01-27 00:54:25 +01:00
|
|
|
|
|
|
|
const blockstore::Key &key() const;
|
2015-01-28 01:02:32 +01:00
|
|
|
|
|
|
|
void flush() const;
|
2015-01-23 04:39:36 +01:00
|
|
|
private:
|
|
|
|
datanodestore::DataNodeStore *_nodeStore;
|
2015-01-24 00:54:27 +01:00
|
|
|
std::unique_ptr<datanodestore::DataNode> _rootNode;
|
2015-01-23 04:39:36 +01:00
|
|
|
|
|
|
|
std::unique_ptr<datanodestore::DataLeafNode> addDataLeafAt(datanodestore::DataInnerNode *insertPos);
|
2015-02-17 00:40:34 +01:00
|
|
|
cpputils::optional_ownership_ptr<datanodestore::DataNode> createChainOfInnerNodes(unsigned int num, datanodestore::DataLeafNode *leaf);
|
2015-01-23 04:39:36 +01:00
|
|
|
std::unique_ptr<datanodestore::DataLeafNode> addDataLeafToFullTree();
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DataTree);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|