libcryfs/implementations/caching/CachingBlockStore.h

33 lines
819 B
C
Raw Normal View History

#pragma once
#ifndef BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHINGBLOCKSTORE_H_
2015-04-09 19:21:59 +02:00
#define BLOCKSTORE_IMPLEMENTATIONS_CACHING_CACHINGBLOCKSTORE_H_
2015-04-02 18:19:05 +02:00
#include <messmer/cachingstore/CachingStore.h>
#include "../../interface/BlockStore.h"
#include "CachedBlockRef.h"
namespace blockstore {
namespace caching {
2015-04-02 18:19:05 +02:00
class CachingBlockStore: public BlockStore {
public:
CachingBlockStore(std::unique_ptr<BlockStore> baseBlockStore);
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;
DISALLOW_COPY_AND_ASSIGN(CachingBlockStore);
};
}
}
#endif