2015-03-19 11:16:20 +01:00
|
|
|
#pragma once
|
2015-04-02 13:12:29 +02:00
|
|
|
#ifndef BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHINGBLOCKSTORE_H_
|
2015-04-09 19:21:59 +02:00
|
|
|
#define BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHINGBLOCKSTORE_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-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-04-16 13:59:52 +02:00
|
|
|
class ParallelAccessBlockStore: public BlockStore {
|
2015-03-19 11:16:20 +01:00
|
|
|
public:
|
2015-04-16 13:59:52 +02:00
|
|
|
ParallelAccessBlockStore(std::unique_ptr<BlockStore> baseBlockStore);
|
2015-03-19 11:16:20 +01:00
|
|
|
|
|
|
|
std::unique_ptr<Block> create(size_t size) override;
|
|
|
|
std::unique_ptr<Block> load(const Key &key) override;
|
|
|
|
void remove(std::unique_ptr<Block> block) override;
|
|
|
|
uint64_t numBlocks() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<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
|