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 "ametsuchi/storage.hpp"
13 #include "cache/cache.hpp"
14 #include "cryptography/hash.hpp"
16 #include "logger/logger_fwd.hpp"
18 #include "torii/status_bus.hpp"
19 
20 namespace iroha {
21  namespace torii {
26  public:
27  // TODO: 2019-03-13 @muratovv fix with abstract cache type IR-397
30  std::shared_ptr<shared_model::interface::TransactionResponse>,
32 
44  std::shared_ptr<iroha::torii::TransactionProcessor> tx_processor,
45  std::shared_ptr<iroha::ametsuchi::Storage> storage,
46  std::shared_ptr<iroha::torii::StatusBus> status_bus,
47  std::shared_ptr<shared_model::interface::TxStatusFactory>
48  status_factory,
49  std::shared_ptr<iroha::torii::CommandServiceImpl::CacheType> cache,
50  std::shared_ptr<iroha::ametsuchi::TxPresenceCache> tx_presence_cache,
51  logger::LoggerPtr log);
52 
53  ~CommandServiceImpl() override;
54 
59  CommandServiceImpl(const CommandServiceImpl &) = delete;
61 
63  std::shared_ptr<shared_model::interface::TransactionBatch> batch)
64  override;
65 
66  std::shared_ptr<shared_model::interface::TransactionResponse> getStatus(
67  const shared_model::crypto::Hash &request) override;
68  rxcpp::observable<
69  std::shared_ptr<shared_model::interface::TransactionResponse>>
70  getStatusStream(const shared_model::crypto::Hash &hash) override;
71 
72  private:
79  inline void handleEvents(rxcpp::composite_subscription &subscription,
80  rxcpp::schedulers::run_loop &run_loop);
81 
87  void pushStatus(
88  const std::string &who,
89  std::shared_ptr<shared_model::interface::TransactionResponse>
90  response);
91 
97  void processBatch(
98  std::shared_ptr<shared_model::interface::TransactionBatch> batch);
99 
100  std::shared_ptr<iroha::torii::TransactionProcessor> tx_processor_;
101  std::shared_ptr<iroha::ametsuchi::Storage> storage_;
102  std::shared_ptr<iroha::torii::StatusBus> status_bus_;
103  std::shared_ptr<CacheType> cache_;
104  std::shared_ptr<shared_model::interface::TxStatusFactory> status_factory_;
105  std::shared_ptr<iroha::ametsuchi::TxPresenceCache> tx_presence_cache_;
106 
107  rxcpp::composite_subscription status_subscription_;
108 
109  logger::LoggerPtr log_;
110  };
111 
112  } // namespace torii
113 } // namespace iroha
114 
115 #endif // TORII_COMMAND_SERVICE_IMPL_HPP
void handleTransactionBatch(std::shared_ptr< shared_model::interface::TransactionBatch > batch) override
Definition: command_service_impl.cpp:59
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:20
Definition: block_query.hpp:14
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:128
Definition: command_service.hpp:26
~CommandServiceImpl() override
Definition: command_service_impl.cpp:55
Definition: command_service_impl.hpp:25
Definition: cache.hpp:25
Definition: hash.hpp:23
std::shared_ptr< shared_model::interface::TransactionResponse > getStatus(const shared_model::crypto::Hash &request) override
Definition: command_service_impl.cpp:65