hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
transaction_processor_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TRANSACTION_PROCESSOR_STUB_HPP
7 #define IROHA_TRANSACTION_PROCESSOR_STUB_HPP
8 
10 
14 #include "logger/logger_fwd.hpp"
17 #include "torii/status_bus.hpp"
19 
20 namespace iroha {
21  namespace torii {
23  public:
32  std::shared_ptr<network::PeerCommunicationService> pcs,
33  std::shared_ptr<MstProcessor> mst_processor,
34  std::shared_ptr<iroha::torii::StatusBus> status_bus,
35  std::shared_ptr<shared_model::interface::TxStatusFactory>
36  status_factory,
37  logger::LoggerPtr log);
38 
39  void batchHandle(
40  std::shared_ptr<shared_model::interface::TransactionBatch>
41  transaction_batch) const override;
42 
44  simulator::VerifiedProposalCreatorEvent const &event) override;
45 
46  void processCommit(
47  std::shared_ptr<const shared_model::interface::Block> const &block)
48  override;
49 
50  void processStateUpdate(std::shared_ptr<MstState> const &state) override;
51 
53  std::shared_ptr<shared_model::interface::TransactionBatch> const
54  &batch) override;
55 
57  std::shared_ptr<shared_model::interface::TransactionBatch> const
58  &batch) override;
59 
60  private:
61  // connections
62  std::shared_ptr<network::PeerCommunicationService> pcs_;
63 
64  // processing
65  std::shared_ptr<MstProcessor> mst_processor_;
66 
67  std::shared_ptr<iroha::torii::StatusBus> status_bus_;
68 
69  // keeps hashes of transaction, which were committed during this round
70  std::vector<shared_model::interface::types::HashType> current_txs_hashes_;
71 
72  // creates transaction status
73  std::shared_ptr<shared_model::interface::TxStatusFactory> status_factory_;
74 
75  logger::LoggerPtr log_;
76 
77  // TODO: [IR-1665] Akvinikym 29.08.18: Refactor method publishStatus(..)
81  enum class TxStatusType {
82  kStatelessFailed,
83  kStatelessValid,
84  kStatefulFailed,
85  kStatefulValid,
86  kRejected,
87  kCommitted,
88  kMstExpired,
89  kNotReceived,
90  kMstPending,
91  kEnoughSignaturesCollected
92  };
99  void publishStatus(TxStatusType tx_status,
101  const validation::CommandError &cmd_error =
102  validation::CommandError{}) const;
103 
109  void publishEnoughSignaturesStatus(
111  const;
112  };
113  } // namespace torii
114 } // namespace iroha
115 
116 #endif // IROHA_TRANSACTION_PROCESSOR_STUB_HPP
Definition: transaction_processor_impl.hpp:22
Definition: transaction_processor.hpp:28
void processCommit(std::shared_ptr< const shared_model::interface::Block > const &block) override
Definition: transaction_processor_impl.cpp:101
Definition: hash.hpp:18
Definition: command_client.hpp:16
void processStateUpdate(std::shared_ptr< MstState > const &state) override
Definition: transaction_processor_impl.cpp:115
TransactionProcessorImpl(std::shared_ptr< network::PeerCommunicationService > pcs, std::shared_ptr< MstProcessor > mst_processor, std::shared_ptr< iroha::torii::StatusBus > status_bus, std::shared_ptr< shared_model::interface::TxStatusFactory > status_factory, logger::LoggerPtr log)
Definition: transaction_processor_impl.cpp:49
void processPreparedBatch(std::shared_ptr< shared_model::interface::TransactionBatch > const &batch) override
Definition: transaction_processor_impl.cpp:123
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:15
void processExpiredBatch(std::shared_ptr< shared_model::interface::TransactionBatch > const &batch) override
Definition: transaction_processor_impl.cpp:131
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
void processVerifiedProposalCreatorEvent(simulator::VerifiedProposalCreatorEvent const &event) override
Definition: transaction_processor_impl.cpp:77
Definition: stateful_validator_common.hpp:30
std::vector< std::shared_ptr< Transaction > > SharedTxsCollectionType
Definition: transaction_sequence_common.hpp:27
Definition: verified_proposal_creator_common.hpp:21
void batchHandle(std::shared_ptr< shared_model::interface::TransactionBatch > transaction_batch) const override
Definition: transaction_processor_impl.cpp:62