hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
gate_object.hpp
Go to the documentation of this file.
1 
6 #ifndef CONSENSUS_GATE_OBJECT_HPP
7 #define CONSENSUS_GATE_OBJECT_HPP
8 
9 #include <boost/variant.hpp>
11 #include "consensus/round.hpp"
12 #include "cryptography/hash.hpp"
14 
15 namespace shared_model {
16  namespace interface {
17  class Block;
18  } // namespace interface
19 } // namespace shared_model
20 
21 namespace iroha {
22  namespace consensus {
23 
24  struct BaseGateObject {
26  std::shared_ptr<const LedgerState> ledger_state;
27 
29  std::shared_ptr<const LedgerState> ledger_state)
30  : round(std::move(round)), ledger_state(std::move(ledger_state)) {}
31  };
32 
34  struct PairValid : public BaseGateObject {
35  std::shared_ptr<shared_model::interface::Block> block;
36 
38  std::shared_ptr<const LedgerState> ledger_state,
39  std::shared_ptr<shared_model::interface::Block> block)
40  : BaseGateObject(std::move(round), std::move(ledger_state)),
41  block(std::move(block)) {}
42  };
43 
44  struct Synchronizable : public BaseGateObject {
46 
48  consensus::Round round,
49  std::shared_ptr<const LedgerState> ledger_state,
51  : BaseGateObject(std::move(round), std::move(ledger_state)),
52  public_keys(std::move(public_keys)) {}
53  };
54 
56  struct VoteOther : public Synchronizable {
58 
60  consensus::Round round,
61  std::shared_ptr<const LedgerState> ledger_state,
64  : Synchronizable(std::move(round),
65  std::move(ledger_state),
66  std::move(public_keys)),
67  hash(std::move(hash)) {}
68  };
69 
71  struct ProposalReject : public Synchronizable {
72  using Synchronizable::Synchronizable;
73  };
74 
76  struct BlockReject : public Synchronizable {
77  using Synchronizable::Synchronizable;
78  };
79 
81  struct AgreementOnNone : public Synchronizable {
82  using Synchronizable::Synchronizable;
83  };
84 
86  struct Future : public Synchronizable {
87  using Synchronizable::Synchronizable;
88  };
89 
90  using GateObject = boost::variant<PairValid,
91  VoteOther,
96 
97  } // namespace consensus
98 } // namespace iroha
99 
100 extern template class boost::variant<iroha::consensus::PairValid,
106 
107 #endif // CONSENSUS_GATE_OBJECT_HPP
round.block_round > ledger_state->top_block_info.height + 1
Definition: gate_object.hpp:86
Current pair is valid.
Definition: gate_object.hpp:34
Definition: hash.hpp:18
consensus::Round round
Definition: gate_object.hpp:25
VoteOther(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state, shared_model::interface::types::PublicKeyCollectionType public_keys, shared_model::interface::types::HashType hash)
Definition: gate_object.hpp:59
Network votes for another pair and round.
Definition: gate_object.hpp:56
Definition: gate_object.hpp:24
shared_model::interface::types::PublicKeyCollectionType public_keys
Definition: gate_object.hpp:45
Synchronizable(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state, shared_model::interface::types::PublicKeyCollectionType public_keys)
Definition: gate_object.hpp:47
Agreement on <None, None>
Definition: gate_object.hpp:81
Definition: peer.hpp:48
std::vector< std::string > PublicKeyCollectionType
Type of public keys&#39; collection.
Definition: types.hpp:52
Definition: gate_object.hpp:44
std::shared_ptr< shared_model::interface::Block > block
Definition: gate_object.hpp:35
PairValid(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state, std::shared_ptr< shared_model::interface::Block > block)
Definition: gate_object.hpp:37
Definition: block_query.hpp:15
BaseGateObject(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state)
Definition: gate_object.hpp:28
shared_model::interface::types::HashType hash
Definition: gate_object.hpp:57
Reject on proposal.
Definition: gate_object.hpp:71
Definition: round.hpp:31
Definition: command_executor.hpp:12
std::shared_ptr< const LedgerState > ledger_state
Definition: gate_object.hpp:26
boost::variant< PairValid, VoteOther, ProposalReject, BlockReject, AgreementOnNone, Future > GateObject
Definition: gate_object.hpp:95
Reject on block.
Definition: gate_object.hpp:76