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-02 18:19:05 +02:00
|
|
|
#include <messmer/cachingstore/CachingStore.h>
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-03-28 18:44:22 +01:00
|
|
|
#include "../../interface/BlockStore.h"
|
2015-04-02 13:12:29 +02:00
|
|
|
#include "CachedBlockRef.h"
|
2015-03-28 18:44:22 +01:00
|
|
|
|
2015-03-19 11:16:20 +01:00
|
|
|
namespace blockstore {
|
2015-04-02 08:59:43 +02:00
|
|
|
namespace caching {
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-02 18:19:05 +02:00
|
|
|
class CachingBlockStore: public BlockStore {
|
2015-03-19 11:16:20 +01:00
|
|
|
public:
|
2015-04-02 08:59:43 +02:00
|
|
|
CachingBlockStore(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-02 18:19:05 +02:00
|
|
|
cachingstore::CachingStore<Block, CachedBlockRef, Key> _cachingStore;
|
2015-03-19 11:16:20 +01:00
|
|
|
|
2015-04-02 08:59:43 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CachingBlockStore);
|
2015-03-19 11:16:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|