hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
wsv_command.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_WSV_COMMAND_HPP
7 #define IROHA_WSV_COMMAND_HPP
8 
9 #include <set>
10 #include <string>
11 
12 #include "common/result.hpp"
15 
16 namespace shared_model {
17  namespace interface {
18  class Asset;
19  class Account;
20  class Domain;
21  class Peer;
22  class AccountAsset;
23  } // namespace interface
24 } // namespace shared_model
25 
26 namespace iroha {
27  namespace ametsuchi {
28 
35  using WsvError = std::string;
36 
43  using WsvCommandResult = expected::Result<void, WsvError>;
44 
48  class WsvCommand {
49  public:
50  virtual ~WsvCommand() = default;
51 
57  virtual WsvCommandResult insertRole(
58  const shared_model::interface::types::RoleIdType &role_name) = 0;
59 
66  virtual WsvCommandResult insertAccountRole(
68  const shared_model::interface::types::RoleIdType &role_name) = 0;
75  virtual WsvCommandResult deleteAccountRole(
77  const shared_model::interface::types::RoleIdType &role_name) = 0;
78 
85  virtual WsvCommandResult insertRolePermissions(
87  const shared_model::interface::RolePermissionSet &permissions) = 0;
88 
96  virtual WsvCommandResult insertAccountGrantablePermission(
98  &permittee_account_id,
101 
110  virtual WsvCommandResult deleteAccountGrantablePermission(
112  &permittee_account_id,
115 
121  virtual WsvCommandResult insertAccount(
122  const shared_model::interface::Account &account) = 0;
123 
129  virtual WsvCommandResult updateAccount(
130  const shared_model::interface::Account &account) = 0;
131 
140  virtual WsvCommandResult setAccountKV(
143  &creator_account_id,
144  const std::string &key,
145  const std::string &val) = 0;
146 
152  virtual WsvCommandResult insertAsset(
153  const shared_model::interface::Asset &asset) = 0;
154 
160  virtual WsvCommandResult upsertAccountAsset(
161  const shared_model::interface::AccountAsset &asset) = 0;
162 
168  virtual WsvCommandResult insertSignatory(
169  const shared_model::interface::types::PubkeyType &signatory) = 0;
170 
177  virtual WsvCommandResult insertAccountSignatory(
179  const shared_model::interface::types::PubkeyType &signatory) = 0;
180 
187  virtual WsvCommandResult deleteAccountSignatory(
189  const shared_model::interface::types::PubkeyType &signatory) = 0;
190 
196  virtual WsvCommandResult deleteSignatory(
197  const shared_model::interface::types::PubkeyType &signatory) = 0;
198 
204  virtual WsvCommandResult insertPeer(
205  const shared_model::interface::Peer &peer) = 0;
206 
212  virtual WsvCommandResult deletePeer(
213  const shared_model::interface::Peer &peer) = 0;
214 
220  virtual WsvCommandResult insertDomain(
221  const shared_model::interface::Domain &domain) = 0;
222  };
223 
224  } // namespace ametsuchi
225 } // namespace iroha
226 
227 #endif // IROHA_WSV_COMMAND_HPP
Definition: account.hpp:20
Grantable
Definition: permissions.hpp:66
Definition: peer.hpp:18
Definition: permissions.hpp:92
Definition: domain.hpp:19
std::string WsvError
Definition: wsv_command.hpp:35
expected::Result< void, WsvError > WsvCommandResult
Definition: wsv_command.hpp:43
Definition: wsv_command.hpp:48
Definition: block_query.hpp:16
std::string AccountIdType
Type of account id.
Definition: types.hpp:35
Definition: asset.hpp:19
Definition: public_key.hpp:16
Definition: command_executor.hpp:12
Definition: account_asset.hpp:20
std::string RoleIdType
Type of role (i.e admin, user)
Definition: types.hpp:47