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 
11 #include <mutex>
12 
13 #include <rxcpp/rx.hpp>
17 #include "logger/logger_fwd.hpp"
20 #include "torii/status_bus.hpp"
21 
22 namespace iroha {
23  namespace torii {
25  public:
35  std::shared_ptr<network::PeerCommunicationService> pcs,
36  std::shared_ptr<MstProcessor> mst_processor,
37  std::shared_ptr<iroha::torii::StatusBus> status_bus,
38  std::shared_ptr<shared_model::interface::TxStatusFactory>
39  status_factory,
40  rxcpp::observable<
41  std::shared_ptr<const shared_model::interface::Block>> commits,
42  logger::LoggerPtr log);
43 
44  void batchHandle(
45  std::shared_ptr<shared_model::interface::TransactionBatch>
46  transaction_batch) const override;
47 
48  private:
49  // connections
50  std::shared_ptr<network::PeerCommunicationService> pcs_;
51 
52  // processing
53  std::shared_ptr<MstProcessor> mst_processor_;
54 
55  std::shared_ptr<iroha::torii::StatusBus> status_bus_;
56 
57  // internal
58  rxcpp::subjects::subject<
59  std::shared_ptr<shared_model::interface::TransactionResponse>>
60  notifier_;
61 
62  // keeps hashes of transaction, which were committed during this round
63  std::vector<shared_model::interface::types::HashType> current_txs_hashes_;
64 
65  // creates transaction status
66  std::shared_ptr<shared_model::interface::TxStatusFactory> status_factory_;
67 
68  logger::LoggerPtr log_;
69 
70  // TODO: [IR-1665] Akvinikym 29.08.18: Refactor method publishStatus(..)
74  enum class TxStatusType {
75  kStatelessFailed,
76  kStatelessValid,
77  kStatefulFailed,
78  kStatefulValid,
79  kRejected,
80  kCommitted,
81  kMstExpired,
82  kNotReceived,
83  kMstPending,
84  kEnoughSignaturesCollected
85  };
92  void publishStatus(TxStatusType tx_status,
94  const validation::CommandError &cmd_error =
95  validation::CommandError{}) const;
96 
102  void publishEnoughSignaturesStatus(
104  const;
105  };
106  } // namespace torii
107 } // namespace iroha
108 
109 #endif // IROHA_TRANSACTION_PROCESSOR_STUB_HPP
Definition: transaction_processor_impl.hpp:24
Definition: transaction_processor.hpp:23
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, rxcpp::observable< std::shared_ptr< const shared_model::interface::Block >> commits, logger::LoggerPtr log)
Definition: transaction_processor_impl.cpp:46
Definition: hash.hpp:18
Definition: command_client.hpp:16
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:16
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
Definition: stateful_validator_common.hpp:30
std::vector< std::shared_ptr< Transaction >> SharedTxsCollectionType
Definition: transaction_sequence_common.hpp:27
void batchHandle(std::shared_ptr< shared_model::interface::TransactionBatch > transaction_batch) const override
Definition: transaction_processor_impl.cpp:122