hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
ordering_gate_cache.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_ORDERING_CACHE_HPP
7 #define IROHA_ON_DEMAND_ORDERING_CACHE_HPP
8 
9 #include <memory>
10 #include <unordered_set>
11 
12 #include "cryptography/hash.hpp"
13 
14 namespace shared_model {
15  namespace interface {
16  class TransactionBatch;
17  }
18 } // namespace shared_model
19 
20 namespace iroha {
21  namespace ordering {
22  namespace cache {
23 
28  private:
32  struct BatchPointerHasher {
34 
35  size_t operator()(
36  const std::shared_ptr<shared_model::interface::TransactionBatch>
37  &a) const;
38  };
39 
40  public:
44  using BatchesSetType = std::unordered_set<
45  std::shared_ptr<shared_model::interface::TransactionBatch>,
46  BatchPointerHasher>;
47 
48  using HashesSetType =
49  std::unordered_set<shared_model::crypto::Hash,
51 
55  virtual void addToBack(const BatchesSetType &batches) = 0;
56 
60  virtual BatchesSetType pop() = 0;
61 
65  virtual void remove(const HashesSetType &hashes) = 0;
66 
70  virtual const BatchesSetType &head() const = 0;
71 
75  virtual const BatchesSetType &tail() const = 0;
76 
77  virtual ~OrderingGateCache() = default;
78  };
79 
80  } // namespace cache
81 
82  } // namespace ordering
83 } // namespace iroha
84 
85 #endif // IROHA_ON_DEMAND_ORDERING_CACHE_HPP
Definition: hash.hpp:18
std::unordered_set< std::shared_ptr< shared_model::interface::TransactionBatch >, BatchPointerHasher > BatchesSetType
Definition: ordering_gate_cache.hpp:46
Definition: block_query.hpp:15
std::unordered_set< shared_model::crypto::Hash, shared_model::crypto::Hash::Hasher > HashesSetType
Definition: ordering_gate_cache.hpp:50
Definition: ordering_gate_cache.hpp:27
Definition: command_executor.hpp:12
Definition: hash.hpp:23