Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
buffer_cache.h
1 #pragma once
2 
3 #include "storage_engine/compression.h"
4 
5 #include <list>
6 #include <map>
7 #include <memory>
8 #include <mutex>
9 
10 namespace Akumuli {
11 
12 struct ChunkCache {
14  typedef std::tuple<int, int> KeyT;
15  typedef std::tuple<KeyT, size_t> QueueItemT;
16  typedef std::shared_ptr<UncompressedChunk> ItemT;
17 
18  std::map<KeyT, ItemT> cache_;
19  std::list<QueueItemT> fifo_;
20  size_t total_size_;
21  mutable std::mutex mutex_;
22  const size_t size_limit_;
23 
24  ChunkCache(size_t limit);
25 
26  bool contains(KeyT key) const;
27 
28  ItemT get(KeyT key);
29 
30  void put(KeyT key, const std::shared_ptr<UncompressedChunk>& header);
31 };
32 }
std::tuple< int, int > KeyT
Volume id + entry index.
Definition: buffer_cache.h:14
Definition: buffer_cache.h:12