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 <unordered_set>
10 
11 #include "cryptography/hash.hpp"
12 
13 namespace shared_model {
14  namespace interface {
15  class TransactionBatch;
16  }
17 } // namespace shared_model
18 
19 namespace iroha {
20  namespace ordering {
21  namespace cache {
22 
27  private:
31  struct BatchPointerHasher {
33 
34  size_t operator()(
35  const std::shared_ptr<shared_model::interface::TransactionBatch>
36  &a) const;
37  };
38 
39  public:
43  using BatchesSetType = std::unordered_set<
44  std::shared_ptr<shared_model::interface::TransactionBatch>,
45  BatchPointerHasher>;
46 
47  using HashesSetType =
48  std::unordered_set<shared_model::crypto::Hash,
50 
54  virtual void addToBack(const BatchesSetType &batches) = 0;
55 
59  virtual BatchesSetType pop() = 0;
60 
64  virtual void remove(const HashesSetType &hashes) = 0;
65 
69  virtual const BatchesSetType &head() const = 0;
70 
74  virtual const BatchesSetType &tail() const = 0;
75 
76  virtual ~OrderingGateCache() = default;
77  };
78 
79  } // namespace cache
80 
81  } // namespace ordering
82 } // namespace iroha
83 
84 #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:45
Definition: block_query.hpp:16
std::unordered_set< shared_model::crypto::Hash, shared_model::crypto::Hash::Hasher > HashesSetType
Definition: ordering_gate_cache.hpp:49
Definition: ordering_gate_cache.hpp:26
Definition: command_executor.hpp:12
Definition: hash.hpp:23