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  class SetSettingValue;
39  } // namespace interface
40 } // namespace shared_model
41 
42 namespace iroha {
43  namespace ametsuchi {
44 
46  public:
48  std::unique_ptr<soci::session> sql,
49  std::shared_ptr<shared_model::interface::PermissionToString>
50  perm_converter);
51 
53 
56  &creator_account_id,
57  bool do_validation) override;
58 
59  soci::session &getSession();
60 
61  CommandResult operator()(
64  &creator_account_id,
65  bool do_validation);
66 
67  CommandResult operator()(
68  const shared_model::interface::AddPeer &command,
70  &creator_account_id,
71  bool do_validation);
72 
73  CommandResult operator()(
76  &creator_account_id,
77  bool do_validation);
78 
79  CommandResult operator()(
82  &creator_account_id,
83  bool do_validation);
84 
85  CommandResult operator()(
88  &creator_account_id,
89  bool do_validation);
90 
91  CommandResult operator()(
94  &creator_account_id,
95  bool do_validation);
96 
97  CommandResult operator()(
100  &creator_account_id,
101  bool do_validation);
102 
103  CommandResult operator()(
106  &creator_account_id,
107  bool do_validation);
108 
109  CommandResult operator()(
112  &creator_account_id,
113  bool do_validation);
114 
115  CommandResult operator()(
118  &creator_account_id,
119  bool do_validation);
120 
121  CommandResult operator()(
124  &creator_account_id,
125  bool do_validation);
126 
127  CommandResult operator()(
130  &creator_account_id,
131  bool do_validation);
132 
133  CommandResult operator()(
136  &creator_account_id,
137  bool do_validation);
138 
139  CommandResult operator()(
142  &creator_account_id,
143  bool do_validation);
144 
145  CommandResult operator()(
148  &creator_account_id,
149  bool do_validation);
150 
151  CommandResult operator()(
152  const shared_model::interface::SetQuorum &command,
154  &creator_account_id,
155  bool do_validation);
156 
157  CommandResult operator()(
160  &creator_account_id,
161  bool do_validation);
162 
163  CommandResult operator()(
166  &creator_account_id,
167  bool do_validation);
168 
169  CommandResult operator()(
172  &creator_account_id,
173  bool do_validation);
174 
175  private:
176  class CommandStatements;
177  class StatementExecutor;
178 
179  void initStatements();
180 
181  std::unique_ptr<CommandStatements> makeCommandStatements(
182  const std::unique_ptr<soci::session> &session,
183  const std::string &base_statement,
184  const std::vector<std::string> &permission_checks);
185 
186  std::unique_ptr<soci::session> sql_;
187 
188  std::shared_ptr<shared_model::interface::PermissionToString>
189  perm_converter_;
190 
191  std::unique_ptr<CommandStatements> add_asset_quantity_statements_;
192  std::unique_ptr<CommandStatements> add_peer_statements_;
193  std::unique_ptr<CommandStatements> add_signatory_statements_;
194  std::unique_ptr<CommandStatements> append_role_statements_;
195  std::unique_ptr<CommandStatements>
196  compare_and_set_account_detail_statements_;
197  std::unique_ptr<CommandStatements> create_account_statements_;
198  std::unique_ptr<CommandStatements> create_asset_statements_;
199  std::unique_ptr<CommandStatements> create_domain_statements_;
200  std::unique_ptr<CommandStatements> create_role_statements_;
201  std::unique_ptr<CommandStatements> detach_role_statements_;
202  std::unique_ptr<CommandStatements> grant_permission_statements_;
203  std::unique_ptr<CommandStatements> remove_peer_statements_;
204  std::unique_ptr<CommandStatements> remove_signatory_statements_;
205  std::unique_ptr<CommandStatements> revoke_permission_statements_;
206  std::unique_ptr<CommandStatements> set_account_detail_statements_;
207  std::unique_ptr<CommandStatements> set_quorum_statements_;
208  std::unique_ptr<CommandStatements> subtract_asset_quantity_statements_;
209  std::unique_ptr<CommandStatements> transfer_asset_statements_;
210  std::unique_ptr<CommandStatements> set_setting_value_statements_;
211  };
212  } // namespace ametsuchi
213 } // namespace iroha
214 
215 #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: set_setting_value.hpp:19
Definition: postgres_command_executor.cpp:388
Definition: detach_role.hpp:19
Definition: remove_signatory.hpp:18
Definition: create_asset.hpp:18
Definition: postgres_command_executor.cpp:349
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:45
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:40
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