hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
temporary_wsv_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TEMPORARY_WSV_IMPL_HPP
7 #define IROHA_TEMPORARY_WSV_IMPL_HPP
8 
10 
11 #include <soci/soci.h>
13 #include "logger/logger_fwd.hpp"
15 
16 namespace shared_model {
17  namespace interface {
18  class PermissionToString;
19  }
20 } // namespace shared_model
21 
22 namespace iroha {
23 
24  namespace ametsuchi {
25  class PostgresCommandExecutor;
26  class TransactionExecutor;
27 
28  class TemporaryWsvImpl : public TemporaryWsv {
29  friend class StorageImpl;
30 
31  public:
34  std::string savepoint_name,
35  logger::LoggerPtr log);
36 
37  void release() override;
38 
39  ~SavepointWrapperImpl() override;
40 
41  private:
42  soci::session &sql_;
43  std::string savepoint_name_;
44  bool is_released_;
45  logger::LoggerPtr log_;
46  };
47 
49  std::shared_ptr<PostgresCommandExecutor> command_executor,
50  logger::LoggerManagerTreePtr log_manager);
51 
52  expected::Result<void, validation::CommandError> apply(
53  const shared_model::interface::Transaction &transaction) override;
54 
55  std::unique_ptr<TemporaryWsv::SavepointWrapper> createSavepoint(
56  const std::string &name) override;
57 
58  ~TemporaryWsvImpl() override;
59 
60  private:
65  expected::Result<void, validation::CommandError> validateSignatures(
66  const shared_model::interface::Transaction &transaction);
67 
68  soci::session &sql_;
69  std::unique_ptr<TransactionExecutor> transaction_executor_;
70 
71  logger::LoggerManagerTreePtr log_manager_;
72  logger::LoggerPtr log_;
73  };
74  } // namespace ametsuchi
75 } // namespace iroha
76 
77 #endif // IROHA_TEMPORARY_WSV_IMPL_HPP
decltype(auto) constexpr apply(Tuple &&t, F &&f)
apply F to Tuple
Definition: soci_utils.hpp:72
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: temporary_wsv_impl.hpp:28
Definition: temporary_wsv.hpp:27
Definition: block_query.hpp:14
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
Definition: temporary_wsv.hpp:33
Definition: command_executor.hpp:12
Definition: storage_impl.hpp:38
Definition: transaction.hpp:23