hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
command_executor.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_AMETSUCHI_COMMAND_EXECUTOR_HPP
7 #define IROHA_AMETSUCHI_COMMAND_EXECUTOR_HPP
8 
9 #include "common/result.hpp"
11 
12 namespace shared_model {
13  namespace interface {
14  class AddAssetQuantity;
15  class AddPeer;
16  class AddSignatory;
17  class AppendRole;
18  class Command;
19  class CreateAccount;
20  class CreateAsset;
21  class CreateDomain;
22  class CreateRole;
23  class DetachRole;
24  class GrantPermission;
25  class RemoveSignatory;
26  class RevokePermission;
27  class SetAccountDetail;
28  class SetQuorum;
30  class TransferAsset;
31  } // namespace interface
32 } // namespace shared_model
33 
34 namespace iroha {
35  namespace ametsuchi {
36 
41  struct CommandError {
42  using ErrorCodeType = uint32_t;
43 
44  std::string command_name;
46  std::string error_extra;
47 
48  std::string toString() const;
49  };
50 
57  using CommandResult = expected::Result<void, CommandError>;
58 
59  class CommandExecutor : public boost::static_visitor<CommandResult> {
60  public:
61  virtual ~CommandExecutor() = default;
62 
64 
65  virtual void setCreatorAccountId(
67  &creator_account_id) = 0;
68 
69  virtual void doValidation(bool do_validation) = 0;
70 
71  virtual CommandResult operator()(
73 
74  virtual CommandResult operator()(
75  const shared_model::interface::AddPeer &command) = 0;
76 
77  virtual CommandResult operator()(
78  const shared_model::interface::AddSignatory &command) = 0;
79 
80  virtual CommandResult operator()(
81  const shared_model::interface::AppendRole &command) = 0;
82 
83  virtual CommandResult operator()(
84  const shared_model::interface::CreateAccount &command) = 0;
85 
86  virtual CommandResult operator()(
87  const shared_model::interface::CreateAsset &command) = 0;
88 
89  virtual CommandResult operator()(
90  const shared_model::interface::CreateDomain &command) = 0;
91 
92  virtual CommandResult operator()(
93  const shared_model::interface::CreateRole &command) = 0;
94 
95  virtual CommandResult operator()(
96  const shared_model::interface::DetachRole &command) = 0;
97 
98  virtual CommandResult operator()(
99  const shared_model::interface::GrantPermission &command) = 0;
100 
101  virtual CommandResult operator()(
102  const shared_model::interface::RemoveSignatory &command) = 0;
103 
104  virtual CommandResult operator()(
105  const shared_model::interface::RevokePermission &command) = 0;
106 
107  virtual CommandResult operator()(
108  const shared_model::interface::SetAccountDetail &command) = 0;
109 
110  virtual CommandResult operator()(
111  const shared_model::interface::SetQuorum &command) = 0;
112 
113  virtual CommandResult operator()(
115 
116  virtual CommandResult operator()(
117  const shared_model::interface::TransferAsset &command) = 0;
118  };
119  } // namespace ametsuchi
120 } // namespace iroha
121 
122 #endif // IROHA_AMETSUCHI_COMMAND_EXECUTOR_HPP
Definition: add_signatory.hpp:19
expected::Result< void, CommandError > CommandResult
Definition: command_executor.hpp:57
Definition: set_quorum.hpp:18
std::string error_extra
Definition: command_executor.hpp:46
Definition: subtract_asset_quantity.hpp:20
Definition: detach_role.hpp:19
Definition: remove_signatory.hpp:18
Definition: create_asset.hpp:18
std::string command_name
Definition: command_executor.hpp:44
Definition: append_role.hpp:19
Definition: transfer_asset.hpp:19
Definition: block_query.hpp:14
std::string AccountIdType
Type of account id.
Definition: types.hpp:37
Definition: command_executor.hpp:59
ErrorCodeType error_code
Definition: command_executor.hpp:45
Definition: create_domain.hpp:18
Definition: command_executor.hpp:41
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
std::string toString(interface::permissions::Role r)
Definition: permissions.cpp:22
Definition: revoke_permission.hpp:19
Definition: command.hpp:37
Definition: add_asset_quantity.hpp:20
uint32_t ErrorCodeType
Definition: command_executor.hpp:42
Definition: create_role.hpp:19
Definition: command_executor.hpp:12
Definition: add_peer.hpp:20