hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::ametsuchi::RocksDbCommandExecutor Class Referencefinal

#include "rocksdb_command_executor.hpp"

Inheritance diagram for iroha::ametsuchi::RocksDbCommandExecutor:
Inheritance graph
Collaboration diagram for iroha::ametsuchi::RocksDbCommandExecutor:
Collaboration graph

Public Types

enum  ErrorCodes {
  kNoPermissions = 2, kNoAccount = 3, kInvalidAmount = 3, kRoleAlreadyExists = 3,
  kSignatoryMustNotExist = 3, kInvalidAssetAmount = 4, kIncorrectOldValue = 4, kPeersCountIsNotEnough = 4,
  kNoSignatory = 4, kCountNotEnough = 5, kNotEnoughAssets = 6, kIncorrectBalance = 7,
  kException = 1002, kNoImplementation = 1005, kPermissionIsAlreadySet = 1007, kPublicKeyIsEmpty = 1008,
  kInvalidFieldSize = 1009
}
 
using ExecutionResult = expected::Result< void, DbError >
 

Public Member Functions

 RocksDbCommandExecutor (std::shared_ptr< RocksDBContext > db_context, std::shared_ptr< shared_model::interface::PermissionToString > perm_converter, std::optional< std::reference_wrapper< const VmCaller >> vm_caller)
 
 ~RocksDbCommandExecutor ()
 
CommandResult execute (const shared_model::interface::Command &cmd, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation) override
 
void skipChanges () override
 
DatabaseTransactiondbSession () override
 
std::shared_ptr< RocksDBContextgetSession ()
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::AddAssetQuantity &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::AddPeer &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::AddSignatory &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CallEngine &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::AppendRole &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CompareAndSetAccountDetail &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CreateAccount &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CreateAsset &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CreateDomain &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::CreateRole &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::DetachRole &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::GrantPermission &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::RemovePeer &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::RemoveSignatory &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::RevokePermission &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::SetAccountDetail &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::SetQuorum &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::SubtractAssetQuantity &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::TransferAsset &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &tx_hash, shared_model::interface::types::CommandIndexType cmd_index, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
ExecutionResult operator() (RocksDbCommon &common, const shared_model::interface::SetSettingValue &command, const shared_model::interface::types::AccountIdType &creator_account_id, const std::string &, shared_model::interface::types::CommandIndexType, bool do_validation, shared_model::interface::RolePermissionSet const &creator_permissions)
 
- Public Member Functions inherited from iroha::ametsuchi::CommandExecutor
virtual ~CommandExecutor ()=default
 

Member Typedef Documentation

◆ ExecutionResult

Member Enumeration Documentation

◆ ErrorCodes

Enumerator
kNoPermissions 
kNoAccount 
kInvalidAmount 
kRoleAlreadyExists 
kSignatoryMustNotExist 
kInvalidAssetAmount 
kIncorrectOldValue 
kPeersCountIsNotEnough 
kNoSignatory 
kCountNotEnough 
kNotEnoughAssets 
kIncorrectBalance 
kException 
kNoImplementation 
kPermissionIsAlreadySet 
kPublicKeyIsEmpty 
kInvalidFieldSize 

Constructor & Destructor Documentation

◆ RocksDbCommandExecutor()

RocksDbCommandExecutor::RocksDbCommandExecutor ( std::shared_ptr< RocksDBContext db_context,
std::shared_ptr< shared_model::interface::PermissionToString perm_converter,
std::optional< std::reference_wrapper< const VmCaller >>  vm_caller 
)
Here is the call graph for this function:

◆ ~RocksDbCommandExecutor()

RocksDbCommandExecutor::~RocksDbCommandExecutor ( )
default
Here is the caller graph for this function:

Member Function Documentation

◆ dbSession()

DatabaseTransaction & RocksDbCommandExecutor::dbSession ( )
overridevirtual

◆ execute()

CommandResult RocksDbCommandExecutor::execute ( const shared_model::interface::Command cmd,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation 
)
overridevirtual

Implements iroha::ametsuchi::CommandExecutor.

Here is the call graph for this function:

◆ getSession()

std::shared_ptr< RocksDBContext > RocksDbCommandExecutor::getSession ( )

◆ operator()() [1/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::AddAssetQuantity command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [2/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::AddPeer command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)

Store address

Store TLS if present

Here is the call graph for this function:

◆ operator()() [3/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::AddSignatory command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [4/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CallEngine command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)

◆ operator()() [5/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::AppendRole command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [6/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CompareAndSetAccountDetail command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [7/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CreateAccount command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [8/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CreateAsset command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [9/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CreateDomain command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [10/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::CreateRole command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [11/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::DetachRole command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [12/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::GrantPermission command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [13/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::RemovePeer command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [14/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::RemoveSignatory command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [15/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::RevokePermission command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [16/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::SetAccountDetail command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [17/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::SetQuorum command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)

TODO(iceseer): check if is better to store addition value with counter

Here is the call graph for this function:

◆ operator()() [18/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::SubtractAssetQuantity command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [19/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::TransferAsset command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  tx_hash,
shared_model::interface::types::CommandIndexType  cmd_index,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ operator()() [20/20]

RocksDbCommandExecutor::ExecutionResult RocksDbCommandExecutor::operator() ( RocksDbCommon common,
const shared_model::interface::SetSettingValue command,
const shared_model::interface::types::AccountIdType creator_account_id,
const std::string &  ,
shared_model::interface::types::CommandIndexType  ,
bool  do_validation,
shared_model::interface::RolePermissionSet const &  creator_permissions 
)
Here is the call graph for this function:

◆ skipChanges()

void RocksDbCommandExecutor::skipChanges ( )
overridevirtual

Implements iroha::ametsuchi::CommandExecutor.

Here is the call graph for this function:

The documentation for this class was generated from the following files: