#pragma once #ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_IMPL_DATANODE_H_ #define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_IMPL_DATANODE_H_ #include "blockstore/interface/Block.h" #include namespace blobstore { namespace onblocks { class DataInnerNode; class DataLeafNode; class DataNode { public: virtual ~DataNode(); static constexpr unsigned char magicNumberInnerNode = 0x01; static constexpr unsigned char magicNumberLeaf = 0x02; struct NodeHeader { unsigned char magicNumber; }; void flush(); static std::unique_ptr load(std::unique_ptr block); static std::unique_ptr initializeNewInnerNode(std::unique_ptr block); static std::unique_ptr initializeNewLeafNode(std::unique_ptr block); protected: DataNode(std::unique_ptr block); std::unique_ptr _block; }; } } #endif