#pragma once #ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREE_H_ #define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATATREE_H_ #include #include "messmer/cpp-utils/macros.h" #include "impl/GetLowestRightBorderNodeWithLessThanKChildrenOrNull.h" namespace blockstore { class Key; } 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 rootNode); virtual ~DataTree(); std::unique_ptr addDataLeaf(); const blockstore::Key &key() const; void flush() const; private: datanodestore::DataNodeStore *_nodeStore; std::unique_ptr _rootNode; std::unique_ptr addDataLeafAt(datanodestore::DataInnerNode *insertPos); cpputils::optional_ownership_ptr createChainOfInnerNodes(unsigned int num, datanodestore::DataLeafNode *leaf); std::unique_ptr addDataLeafToFullTree(); DISALLOW_COPY_AND_ASSIGN(DataTree); }; } } } #endif