hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
on_demand_os_transport.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_OS_TRANSPORT_HPP
7 #define IROHA_ON_DEMAND_OS_TRANSPORT_HPP
8 
9 #include <memory>
10 #include <unordered_set>
11 #include <utility>
12 #include <vector>
13 
14 #include <boost/optional.hpp>
15 #include "common/result_fwd.hpp"
16 #include "consensus/round.hpp"
17 #include "cryptography/hash.hpp"
19 
20 namespace shared_model {
21  namespace interface {
22  class TransactionBatch;
23  class Proposal;
24  class Peer;
25  } // namespace interface
26 } // namespace shared_model
27 
28 namespace iroha {
29  namespace ordering {
30  namespace transport {
31 
36  public:
41 
44  size_t operator()(
45  const std::shared_ptr<shared_model::interface::TransactionBatch>
46  &a) const {
47  return hasher_(a->reducedHash());
48  }
49  };
50 
51  using BatchesSetType = std::unordered_set<
52  std::shared_ptr<shared_model::interface::TransactionBatch>,
55 
59  using TransactionBatchType =
60  std::shared_ptr<shared_model::interface::TransactionBatch>;
61 
65  using CollectionType = std::vector<TransactionBatchType>;
66 
71  virtual void onBatches(CollectionType batches) = 0;
72 
79  virtual boost::optional<std::shared_ptr<const ProposalType>>
80  onRequestProposal(consensus::Round round) = 0;
81 
82  virtual ~OdOsNotification() = default;
83  };
84 
89  public:
97  std::string>
98  create(const shared_model::interface::Peer &to) = 0;
99 
100  virtual ~OdOsNotificationFactory() = default;
101  };
102 
103  } // namespace transport
104  } // namespace ordering
105 } // namespace iroha
106 
107 #endif // IROHA_ON_DEMAND_OS_TRANSPORT_HPP
std::shared_ptr< shared_model::interface::TransactionBatch > TransactionBatchType
Definition: on_demand_os_transport.hpp:60
std::unordered_set< std::shared_ptr< shared_model::interface::TransactionBatch >, BatchPointerHasher, shared_model::interface::BatchHashEquality > BatchesSetType
Definition: on_demand_os_transport.hpp:54
shared_model::crypto::Hash::Hasher hasher_
Definition: on_demand_os_transport.hpp:43
Definition: peer.hpp:20
Definition: transaction_batch.hpp:64
Definition: result_fwd.hpp:27
Definition: proposal.hpp:17
Definition: on_demand_os_transport.hpp:88
Definition: block_query.hpp:15
Definition: on_demand_os_transport.hpp:35
size_t operator()(const std::shared_ptr< shared_model::interface::TransactionBatch > &a) const
Definition: on_demand_os_transport.hpp:44
Definition: round.hpp:31
Definition: command_executor.hpp:12
Definition: hash.hpp:23
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_os_transport.hpp:65