#include #include "datanodestore/DataLeafNode.h" #include "datanodestore/DataNodeStore.h" #include "datatreestore/DataTreeStore.h" #include "datatreestore/DataTree.h" #include "cachingdatatreestore/CachingDataTreeStore.h" #include "cachingdatatreestore/CachedDataTreeRef.h" #include "BlobStoreOnBlocks.h" #include "BlobOnBlocks.h" #include using std::unique_ptr; using std::make_unique; using blockstore::BlockStore; using blockstore::caching::CachingBlockStore; using blockstore::Key; using cpputils::dynamic_pointer_move; namespace blobstore { namespace onblocks { using datanodestore::DataNodeStore; using datatreestore::DataTreeStore; using cachingdatatreestore::CachingDataTreeStore; BlobStoreOnBlocks::BlobStoreOnBlocks(unique_ptr blockStore, uint32_t blocksizeBytes) : _dataTreeStore(make_unique(make_unique(make_unique(make_unique(std::move(blockStore)), blocksizeBytes)))) { } BlobStoreOnBlocks::~BlobStoreOnBlocks() { } unique_ptr BlobStoreOnBlocks::create() { return make_unique(_dataTreeStore->createNewTree()); } unique_ptr BlobStoreOnBlocks::load(const Key &key) { auto tree = _dataTreeStore->load(key); if (tree == nullptr) { return nullptr; } return make_unique(std::move(tree)); } void BlobStoreOnBlocks::remove(unique_ptr blob) { auto _blob = dynamic_pointer_move(blob); _dataTreeStore->remove(_blob->releaseTree()); } } }