hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
postgres_command_executor.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_POSTGRES_COMMAND_EXECUTOR_HPP
7 #define IROHA_POSTGRES_COMMAND_EXECUTOR_HPP
8 
10 
12 
13 namespace soci {
14  class session;
15 }
16 
17 namespace shared_model {
18  namespace interface {
19  class AddAssetQuantity;
20  class AddPeer;
21  class AddSignatory;
22  class AppendRole;
23  class CompareAndSetAccountDetail;
24  class CreateAccount;
25  class CreateAsset;
26  class CreateDomain;
27  class CreateRole;
28  class DetachRole;
29  class GrantPermission;
30  class PermissionToString;
31  class RemovePeer;
32  class RemoveSignatory;
33  class RevokePermission;
34  class SetAccountDetail;
35  class SetQuorum;
36  class SubtractAssetQuantity;
37  class TransferAsset;
38  } // namespace interface
39 } // namespace shared_model
40 
41 namespace iroha {
42  namespace ametsuchi {
43 
45  public:
47  std::unique_ptr<soci::session> sql,
48  std::shared_ptr<shared_model::interface::PermissionToString>
49  perm_converter);
50 
52 
55  &creator_account_id,
56  bool do_validation) override;
57 
58  soci::session &getSession();
59 
60  CommandResult operator()(
63  &creator_account_id,
64  bool do_validation);
65 
66  CommandResult operator()(
67  const shared_model::interface::AddPeer &command,
69  &creator_account_id,
70  bool do_validation);
71 
72  CommandResult operator()(
75  &creator_account_id,
76  bool do_validation);
77 
78  CommandResult operator()(
81  &creator_account_id,
82  bool do_validation);
83 
84  CommandResult operator()(
87  &creator_account_id,
88  bool do_validation);
89 
90  CommandResult operator()(
93  &creator_account_id,
94  bool do_validation);
95 
96  CommandResult operator()(
99  &creator_account_id,
100  bool do_validation);
101 
102  CommandResult operator()(
105  &creator_account_id,
106  bool do_validation);
107 
108  CommandResult operator()(
111  &creator_account_id,
112  bool do_validation);
113 
114  CommandResult operator()(
117  &creator_account_id,
118  bool do_validation);
119 
120  CommandResult operator()(
123  &creator_account_id,
124  bool do_validation);
125 
126  CommandResult operator()(
129  &creator_account_id,
130  bool do_validation);
131 
132  CommandResult operator()(
135  &creator_account_id,
136  bool do_validation);
137 
138  CommandResult operator()(
141  &creator_account_id,
142  bool do_validation);
143 
144  CommandResult operator()(
147  &creator_account_id,
148  bool do_validation);
149 
150  CommandResult operator()(
151  const shared_model::interface::SetQuorum &command,
153  &creator_account_id,
154  bool do_validation);
155 
156  CommandResult operator()(
159  &creator_account_id,
160  bool do_validation);
161 
162  CommandResult operator()(
165  &creator_account_id,
166  bool do_validation);
167 
168  private:
169  class CommandStatements;
170  class StatementExecutor;
171 
172  void initStatements();
173 
174  std::unique_ptr<CommandStatements> makeCommandStatements(
175  const std::unique_ptr<soci::session> &session,
176  const std::string &base_statement,
177  const std::vector<std::string> &permission_checks);
178 
179  std::unique_ptr<soci::session> sql_;
180 
181  std::shared_ptr<shared_model::interface::PermissionToString>
182  perm_converter_;
183 
184  std::unique_ptr<CommandStatements> add_asset_quantity_statements_;
185  std::unique_ptr<CommandStatements> add_peer_statements_;
186  std::unique_ptr<CommandStatements> add_signatory_statements_;
187  std::unique_ptr<CommandStatements> append_role_statements_;
188  std::unique_ptr<CommandStatements>
189  compare_and_set_account_detail_statements_;
190  std::unique_ptr<CommandStatements> create_account_statements_;
191  std::unique_ptr<CommandStatements> create_asset_statements_;
192  std::unique_ptr<CommandStatements> create_domain_statements_;
193  std::unique_ptr<CommandStatements> create_role_statements_;
194  std::unique_ptr<CommandStatements> detach_role_statements_;
195  std::unique_ptr<CommandStatements> grant_permission_statements_;
196  std::unique_ptr<CommandStatements> remove_peer_statements_;
197  std::unique_ptr<CommandStatements> remove_signatory_statements_;
198  std::unique_ptr<CommandStatements> revoke_permission_statements_;
199  std::unique_ptr<CommandStatements> set_account_detail_statements_;
200  std::unique_ptr<CommandStatements> set_quorum_statements_;
201  std::unique_ptr<CommandStatements> subtract_asset_quantity_statements_;
202  std::unique_ptr<CommandStatements> transfer_asset_statements_;
203  };
204  } // namespace ametsuchi
205 } // namespace iroha
206 
207 #endif // IROHA_POSTGRES_COMMAND_EXECUTOR_HPP
Definition: compare_and_set_account_detail.hpp:21
Definition: add_signatory.hpp:19
expected::Result< void, CommandError > CommandResult
Definition: command_executor.hpp:41
Definition: set_quorum.hpp:18
Definition: subtract_asset_quantity.hpp:20
Definition: postgres_command_executor.cpp:357
Definition: detach_role.hpp:19
Definition: remove_signatory.hpp:18
Definition: create_asset.hpp:18
Definition: postgres_command_executor.cpp:318
Definition: remove_peer.hpp:20
Definition: append_role.hpp:19
Definition: transfer_asset.hpp:19
Definition: block_query.hpp:14
Definition: postgres_command_executor.hpp:44
std::string AccountIdType
Type of account id.
Definition: types.hpp:39
Definition: command_executor.hpp:43
Definition: create_domain.hpp:18
Definition: create_account.hpp:19
WsvCommandResult execute(soci::statement &st, Function &&error)
Definition: postgres_wsv_command.cpp:23
Definition: grant_permission.hpp:19
Definition: set_account_detail.hpp:19
Definition: revoke_permission.hpp:19
Definition: command.hpp:39
Definition: add_asset_quantity.hpp:20
Definition: create_role.hpp:19
Definition: command_executor.hpp:12
Definition: pool_wrapper.hpp:11
Definition: add_peer.hpp:20