2015-10-15 13:09:21 +02:00
|
|
|
#pragma once
|
2015-04-16 13:59:52 +02:00
|
|
|
#ifndef MESSMER_BLOCKSTORE_IMPLEMENTATIONS_PARALLELACCESS_PARALLELACCESSBLOCKSTOREADAPTER_H_
|
|
|
|
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_PARALLELACCESS_PARALLELACCESSBLOCKSTOREADAPTER_H_
|
2015-04-02 18:19:05 +02:00
|
|
|
|
|
|
|
#include <messmer/cpp-utils/macros.h>
|
2015-04-16 14:54:04 +02:00
|
|
|
#include <messmer/parallelaccessstore/ParallelAccessStore.h>
|
2015-04-02 18:19:05 +02:00
|
|
|
#include "../../interface/BlockStore.h"
|
|
|
|
|
|
|
|
namespace blockstore {
|
2015-04-16 13:59:52 +02:00
|
|
|
namespace parallelaccess {
|
2015-04-02 18:19:05 +02:00
|
|
|
|
2015-11-27 14:06:40 +01:00
|
|
|
class ParallelAccessBlockStoreAdapter final: public parallelaccessstore::ParallelAccessBaseStore<Block, Key> {
|
2015-04-02 18:19:05 +02:00
|
|
|
public:
|
2015-04-27 18:20:51 +02:00
|
|
|
explicit ParallelAccessBlockStoreAdapter(BlockStore *baseBlockStore)
|
2015-04-02 18:19:05 +02:00
|
|
|
:_baseBlockStore(std::move(baseBlockStore)) {
|
|
|
|
}
|
|
|
|
|
2015-06-26 13:45:03 +02:00
|
|
|
boost::optional<cpputils::unique_ref<Block>> loadFromBaseStore(const Key &key) override {
|
2015-07-21 14:50:52 +02:00
|
|
|
return _baseBlockStore->load(key);
|
2015-04-02 18:19:05 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 13:45:03 +02:00
|
|
|
void removeFromBaseStore(cpputils::unique_ref<Block> block) override {
|
2015-07-21 14:50:52 +02:00
|
|
|
return _baseBlockStore->remove(std::move(block));
|
2015-04-02 18:19:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
BlockStore *_baseBlockStore;
|
|
|
|
|
2015-04-16 13:59:52 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(ParallelAccessBlockStoreAdapter);
|
2015-04-02 18:19:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|