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