hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
command_service_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef TORII_COMMAND_SERVICE_IMPL_HPP
7 #define TORII_COMMAND_SERVICE_IMPL_HPP
8 
10 
11 #include <rxcpp/rx-lite.hpp>
12 #include "ametsuchi/storage.hpp"
14 #include "cache/cache.hpp"
15 #include "cryptography/hash.hpp"
17 #include "logger/logger_fwd.hpp"
19 #include "torii/status_bus.hpp"
20 
21 namespace iroha {
22  namespace torii {
27  public:
28  // TODO: 2019-03-13 @muratovv fix with abstract cache type IR-397
31  std::shared_ptr<shared_model::interface::TransactionResponse>,
33 
45  std::shared_ptr<iroha::torii::TransactionProcessor> tx_processor,
46  std::shared_ptr<iroha::ametsuchi::Storage> storage,
47  std::shared_ptr<iroha::torii::StatusBus> status_bus,
48  std::shared_ptr<shared_model::interface::TxStatusFactory>
49  status_factory,
50  std::shared_ptr<iroha::torii::CommandServiceImpl::CacheType> cache,
51  std::shared_ptr<iroha::ametsuchi::TxPresenceCache> tx_presence_cache,
52  logger::LoggerPtr log);
53 
54  ~CommandServiceImpl() override;
55 
60  CommandServiceImpl(const CommandServiceImpl &) = delete;
62 
64  std::shared_ptr<shared_model::interface::TransactionBatch> batch)
65  override;
66 
67  std::shared_ptr<shared_model::interface::TransactionResponse> getStatus(
68  const shared_model::crypto::Hash &request) override;
69  rxcpp::observable<
70  std::shared_ptr<shared_model::interface::TransactionResponse>>
71  getStatusStream(const shared_model::crypto::Hash &hash) override;
72 
73  private:
80  inline void handleEvents(rxcpp::composite_subscription &subscription,
81  rxcpp::schedulers::run_loop &run_loop);
82 
88  void pushStatus(
89  const std::string &who,
90  std::shared_ptr<shared_model::interface::TransactionResponse>
91  response);
92 
98  void processBatch(
99  std::shared_ptr<shared_model::interface::TransactionBatch> batch);
100 
101  std::shared_ptr<iroha::torii::TransactionProcessor> tx_processor_;
102  std::shared_ptr<iroha::ametsuchi::Storage> storage_;
103  std::shared_ptr<iroha::torii::StatusBus> status_bus_;
104  std::shared_ptr<CacheType> cache_;
105  std::shared_ptr<shared_model::interface::TxStatusFactory> status_factory_;
106  std::shared_ptr<iroha::ametsuchi::TxPresenceCache> tx_presence_cache_;
107 
108  rxcpp::composite_subscription status_subscription_;
109 
110  logger::LoggerPtr log_;
111  };
112 
113  } // namespace torii
114 } // namespace iroha
115 
116 #endif // TORII_COMMAND_SERVICE_IMPL_HPP
void handleTransactionBatch(std::shared_ptr< shared_model::interface::TransactionBatch > batch) override
Definition: command_service_impl.cpp:61
Definition: hash.hpp:18
Definition: command_client.hpp:16
CommandServiceImpl & operator=(const CommandServiceImpl &)=delete
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
CommandServiceImpl(std::shared_ptr< iroha::torii::TransactionProcessor > tx_processor, std::shared_ptr< iroha::ametsuchi::Storage > storage, std::shared_ptr< iroha::torii::StatusBus > status_bus, std::shared_ptr< shared_model::interface::TxStatusFactory > status_factory, std::shared_ptr< iroha::torii::CommandServiceImpl::CacheType > cache, std::shared_ptr< iroha::ametsuchi::TxPresenceCache > tx_presence_cache, logger::LoggerPtr log)
Definition: command_service_impl.cpp:22
Definition: block_query.hpp:15
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
rxcpp::observable< std::shared_ptr< shared_model::interface::TransactionResponse > > getStatusStream(const shared_model::crypto::Hash &hash) override
Definition: command_service_impl.cpp:142
Definition: command_service.hpp:26
~CommandServiceImpl() override
Definition: command_service_impl.cpp:57
Definition: command_service_impl.hpp:26
Definition: cache.hpp:28
Definition: hash.hpp:23
std::shared_ptr< shared_model::interface::TransactionResponse > getStatus(const shared_model::crypto::Hash &request) override
Definition: command_service_impl.cpp:67