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"
15 
16 namespace shared_model {
17  namespace interface {
18  class Block;
19  } // namespace interface
20 } // namespace shared_model
21 
22 namespace iroha {
23  namespace consensus {
24 
25  struct BaseGateObject {
27  std::shared_ptr<const LedgerState> ledger_state;
28 
30  std::shared_ptr<const LedgerState> ledger_state)
31  : round(std::move(round)), ledger_state(std::move(ledger_state)) {}
32  };
33 
35  struct PairValid : public BaseGateObject {
36  std::shared_ptr<shared_model::interface::Block> block;
37 
39  std::shared_ptr<const LedgerState> ledger_state,
40  std::shared_ptr<shared_model::interface::Block> block)
41  : BaseGateObject(std::move(round), std::move(ledger_state)),
42  block(std::move(block)) {}
43  };
44 
45  struct Synchronizable : public BaseGateObject {
47 
49  consensus::Round round,
50  std::shared_ptr<const LedgerState> ledger_state,
52  : BaseGateObject(std::move(round), std::move(ledger_state)),
53  public_keys(std::move(public_keys)) {}
54  };
55 
57  struct VoteOther : public Synchronizable {
59 
61  consensus::Round round,
62  std::shared_ptr<const LedgerState> ledger_state,
65  : Synchronizable(std::move(round),
66  std::move(ledger_state),
67  std::move(public_keys)),
68  hash(std::move(hash)) {}
69  };
70 
72  struct ProposalReject : public Synchronizable {
73  using Synchronizable::Synchronizable;
74  };
75 
77  struct BlockReject : public Synchronizable {
78  using Synchronizable::Synchronizable;
79  };
80 
82  struct AgreementOnNone : public Synchronizable {
83  using Synchronizable::Synchronizable;
84  };
85 
86  using GateObject = boost::variant<PairValid,
87  VoteOther,
91 
92  } // namespace consensus
93 } // namespace iroha
94 
95 extern template class boost::variant<iroha::consensus::PairValid,
100 
101 #endif // CONSENSUS_GATE_OBJECT_HPP
Current pair is valid.
Definition: gate_object.hpp:35
Definition: hash.hpp:18
consensus::Round round
Definition: gate_object.hpp:26
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:60
Network votes for another pair and round.
Definition: gate_object.hpp:57
Definition: gate_object.hpp:25
shared_model::interface::types::PublicKeyCollectionType public_keys
Definition: gate_object.hpp:46
Synchronizable(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state, shared_model::interface::types::PublicKeyCollectionType public_keys)
Definition: gate_object.hpp:48
Agreement on <None, None>
Definition: gate_object.hpp:82
Definition: peer.hpp:48
Definition: gate_object.hpp:45
std::shared_ptr< shared_model::interface::Block > block
Definition: gate_object.hpp:36
PairValid(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state, std::shared_ptr< shared_model::interface::Block > block)
Definition: gate_object.hpp:38
Definition: block_query.hpp:14
BaseGateObject(consensus::Round round, std::shared_ptr< const LedgerState > ledger_state)
Definition: gate_object.hpp:29
shared_model::interface::types::HashType hash
Definition: gate_object.hpp:58
Reject on proposal.
Definition: gate_object.hpp:72
boost::variant< PairValid, VoteOther, ProposalReject, BlockReject, AgreementOnNone > GateObject
Definition: gate_object.hpp:90
std::vector< PubkeyType > PublicKeyCollectionType
Type of public keys&#39; collection.
Definition: types.hpp:49
Definition: round.hpp:31
Definition: command_executor.hpp:12
std::shared_ptr< const LedgerState > ledger_state
Definition: gate_object.hpp:27
Reject on block.
Definition: gate_object.hpp:77