hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
on_demand_cache.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_CACHE_HPP
7 #define IROHA_ON_DEMAND_CACHE_HPP
8 
10 
11 #include <shared_mutex>
12 
13 #include <boost/circular_buffer.hpp>
14 
15 namespace iroha {
16  namespace ordering {
17  namespace cache {
18 
20  public:
21  void addToBack(const BatchesSetType &batches) override;
22 
23  BatchesSetType pop() override;
24 
25  void remove(const HashesSetType &hashes) override;
26 
27  virtual const BatchesSetType &head() const override;
28 
29  virtual const BatchesSetType &tail() const override;
30 
31  private:
32  mutable std::shared_timed_mutex mutex_;
33  using BatchesQueueType = boost::circular_buffer<BatchesSetType>;
34  BatchesQueueType circ_buffer{3, BatchesSetType{}};
35  };
36 
37  } // namespace cache
38  } // namespace ordering
39 } // namespace iroha
40 
41 #endif // IROHA_ON_DEMAND_CACHE_HPP
void addToBack(const BatchesSetType &batches) override
Definition: on_demand_cache.cpp:16
std::unordered_set< std::shared_ptr< shared_model::interface::TransactionBatch >, BatchPointerHasher > BatchesSetType
Definition: ordering_gate_cache.hpp:45
Definition: block_query.hpp:14
std::unordered_set< shared_model::crypto::Hash, shared_model::crypto::Hash::Hasher > HashesSetType
Definition: ordering_gate_cache.hpp:49
BatchesSetType pop() override
Definition: on_demand_cache.cpp:41
virtual const BatchesSetType & tail() const override
Definition: on_demand_cache.cpp:55
Definition: ordering_gate_cache.hpp:26
virtual const BatchesSetType & head() const override
Definition: on_demand_cache.cpp:50
Definition: on_demand_cache.hpp:19