#pragma once #ifndef BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHINGBLOCKSTORE_H_ #define BLOCKSTORE_IMPLEMENTATIONS_CACHIN_CACHINGBLOCKSTORE_H_ #include "CachingStore.h" #include "../../interface/BlockStore.h" #include "CachedBlockRef.h" namespace blockstore { namespace caching { class CachingBlockStore: public BlockStore, private CachingStore { public: CachingBlockStore(std::unique_ptr baseBlockStore); std::unique_ptr create(size_t size) override; std::unique_ptr load(const Key &key) override; void remove(std::unique_ptr block) override; uint64_t numBlocks() const override; protected: const Key &getKey(const Block &block) const override; std::unique_ptr loadFromBaseStore(const Key &key) override; void removeFromBaseStore(std::unique_ptr block) override; private: std::unique_ptr _baseBlockStore; DISALLOW_COPY_AND_ASSIGN(CachingBlockStore); }; } } #endif