2015-10-15 13:10:20 +02:00
|
|
|
#pragma once
|
2015-04-16 15:01:49 +02:00
|
|
|
#ifndef MESSMER_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_PARALLELACCESSDATATREESTORE_PARALLELACCESSDATATREESTOREADAPTER_H_
|
|
|
|
#define MESSMER_BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_PARALLELACCESSDATATREESTORE_PARALLELACCESSDATATREESTOREADAPTER_H_
|
|
|
|
|
|
|
|
#include <messmer/cpp-utils/macros.h>
|
|
|
|
#include <messmer/parallelaccessstore/ParallelAccessStore.h>
|
|
|
|
#include "../datatreestore/DataTreeStore.h"
|
|
|
|
#include "../datatreestore/DataTree.h"
|
|
|
|
|
|
|
|
namespace blobstore {
|
|
|
|
namespace onblocks {
|
|
|
|
namespace parallelaccessdatatreestore {
|
|
|
|
|
2015-11-27 14:06:48 +01:00
|
|
|
class ParallelAccessDataTreeStoreAdapter final: public parallelaccessstore::ParallelAccessBaseStore<datatreestore::DataTree, blockstore::Key> {
|
2015-04-16 15:01:49 +02:00
|
|
|
public:
|
|
|
|
ParallelAccessDataTreeStoreAdapter(datatreestore::DataTreeStore *baseDataTreeStore)
|
|
|
|
:_baseDataTreeStore(std::move(baseDataTreeStore)) {
|
|
|
|
}
|
|
|
|
|
2015-06-26 15:59:18 +02:00
|
|
|
boost::optional<cpputils::unique_ref<datatreestore::DataTree>> loadFromBaseStore(const blockstore::Key &key) override {
|
2015-04-16 15:01:49 +02:00
|
|
|
return _baseDataTreeStore->load(key);
|
|
|
|
}
|
|
|
|
|
2015-06-26 15:59:18 +02:00
|
|
|
void removeFromBaseStore(cpputils::unique_ref<datatreestore::DataTree> dataTree) override {
|
2015-04-16 15:01:49 +02:00
|
|
|
return _baseDataTreeStore->remove(std::move(dataTree));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
datatreestore::DataTreeStore *_baseDataTreeStore;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ParallelAccessDataTreeStoreAdapter);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|