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 CreateAccount;
19  class CreateAsset;
20  class CreateDomain;
21  class CreateRole;
22  class DetachRole;
23  class GrantPermission;
24  class RemoveSignatory;
25  class RevokePermission;
26  class SetAccountDetail;
27  class SetQuorum;
29  class TransferAsset;
30  } // namespace interface
31 } // namespace shared_model
32 
33 namespace iroha {
34  namespace ametsuchi {
35 
40  struct CommandError {
41  using ErrorCodeType = uint32_t;
42 
43  std::string command_name;
45  std::string error_extra;
46 
47  std::string toString() const;
48  };
49 
56  using CommandResult = expected::Result<void, CommandError>;
57 
58  class CommandExecutor : public boost::static_visitor<CommandResult> {
59  public:
60  virtual ~CommandExecutor() = default;
61 
62  virtual void setCreatorAccountId(
64  &creator_account_id) = 0;
65 
66  virtual void doValidation(bool do_validation) = 0;
67 
68  virtual CommandResult operator()(
70 
71  virtual CommandResult operator()(
72  const shared_model::interface::AddPeer &command) = 0;
73 
74  virtual CommandResult operator()(
75  const shared_model::interface::AddSignatory &command) = 0;
76 
77  virtual CommandResult operator()(
78  const shared_model::interface::AppendRole &command) = 0;
79 
80  virtual CommandResult operator()(
81  const shared_model::interface::CreateAccount &command) = 0;
82 
83  virtual CommandResult operator()(
84  const shared_model::interface::CreateAsset &command) = 0;
85 
86  virtual CommandResult operator()(
87  const shared_model::interface::CreateDomain &command) = 0;
88 
89  virtual CommandResult operator()(
90  const shared_model::interface::CreateRole &command) = 0;
91 
92  virtual CommandResult operator()(
93  const shared_model::interface::DetachRole &command) = 0;
94 
95  virtual CommandResult operator()(
96  const shared_model::interface::GrantPermission &command) = 0;
97 
98  virtual CommandResult operator()(
99  const shared_model::interface::RemoveSignatory &command) = 0;
100 
101  virtual CommandResult operator()(
102  const shared_model::interface::RevokePermission &command) = 0;
103 
104  virtual CommandResult operator()(
105  const shared_model::interface::SetAccountDetail &command) = 0;
106 
107  virtual CommandResult operator()(
108  const shared_model::interface::SetQuorum &command) = 0;
109 
110  virtual CommandResult operator()(
112 
113  virtual CommandResult operator()(
114  const shared_model::interface::TransferAsset &command) = 0;
115  };
116  } // namespace ametsuchi
117 } // namespace iroha
118 
119 #endif // IROHA_AMETSUCHI_COMMAND_EXECUTOR_HPP
Definition: add_signatory.hpp:18
expected::Result< void, CommandError > CommandResult
Definition: command_executor.hpp:56
Definition: set_quorum.hpp:17
std::string error_extra
Definition: command_executor.hpp:45
Definition: subtract_asset_quantity.hpp:19
Definition: detach_role.hpp:18
Definition: remove_signatory.hpp:17
Definition: create_asset.hpp:17
std::string command_name
Definition: command_executor.hpp:43
Definition: append_role.hpp:18
Definition: transfer_asset.hpp:18
Definition: block_query.hpp:16
std::string AccountIdType
Type of account id.
Definition: types.hpp:35
Definition: command_executor.hpp:58
ErrorCodeType error_code
Definition: command_executor.hpp:44
Definition: create_domain.hpp:17
Definition: command_executor.hpp:40
Definition: create_account.hpp:18
Definition: grant_permission.hpp:18
Definition: set_account_detail.hpp:18
std::string toString(interface::permissions::Role r)
Definition: permissions.cpp:22
Definition: revoke_permission.hpp:18
Definition: add_asset_quantity.hpp:19
uint32_t ErrorCodeType
Definition: command_executor.hpp:41
Definition: create_role.hpp:21
Definition: command_executor.hpp:12
Definition: add_peer.hpp:19