2015-03-19 11:16:20 +01:00
|
|
|
#pragma once
|
2015-10-15 13:09:21 +02:00
|
|
|
#ifndef MESSMER_BLOCKSTORE_IMPLEMENTATIONS_PARALLELACCESS_PARALLELACCESSBLOCKSTORE_H_
|
|
|
|
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_PARALLELACCESS_PARALLELACCESSBLOCKSTORE_H_
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-16 14:54:04 +02:00
|
|
|
#include <messmer/parallelaccessstore/ParallelAccessStore.h>
|
2015-04-16 13:59:52 +02:00
|
|
|
#include "BlockRef.h"
|
2015-03-28 18:44:22 +01:00
|
|
|
#include "../../interface/BlockStore.h"
|
2015-06-26 15:54:19 +02:00
|
|
|
#include <messmer/cpp-utils/pointer/unique_ref.h>
|
2015-03-28 18:44:22 +01:00
|
|
|
|
2015-03-19 11:16:20 +01:00
|
|
|
namespace blockstore {
|
2015-04-16 13:59:52 +02:00
|
|
|
namespace parallelaccess {
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-15 21:46:15 +02:00
|
|
|
//TODO Check that this blockstore allows parallel destructing of blocks (otherwise we won't encrypt blocks in parallel)
|
2015-11-27 14:06:40 +01:00
|
|
|
class ParallelAccessBlockStore final: public BlockStore {
|
2015-03-19 11:16:20 +01:00
|
|
|
public:
|
2015-06-26 15:54:19 +02:00
|
|
|
explicit ParallelAccessBlockStore(cpputils::unique_ref<BlockStore> baseBlockStore);
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-18 14:47:12 +02:00
|
|
|
Key createKey() override;
|
2015-07-20 18:57:48 +02:00
|
|
|
boost::optional<cpputils::unique_ref<Block>> tryCreate(const Key &key, cpputils::Data data) override;
|
2015-07-21 14:50:52 +02:00
|
|
|
boost::optional<cpputils::unique_ref<Block>> load(const Key &key) override;
|
|
|
|
void remove(cpputils::unique_ref<Block> block) override;
|
2015-03-19 11:16:20 +01:00
|
|
|
uint64_t numBlocks() const override;
|
|
|
|
|
|
|
|
private:
|
2015-06-26 15:54:19 +02:00
|
|
|
cpputils::unique_ref<BlockStore> _baseBlockStore;
|
2015-04-16 15:01:59 +02:00
|
|
|
parallelaccessstore::ParallelAccessStore<Block, BlockRef, Key> _parallelAccessStore;
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-16 13:59:52 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(ParallelAccessBlockStore);
|
2015-03-19 11:16:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|