hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
shared_model::interface::QueryResponseFactory Class Referenceabstract

#include "query_response_factory.hpp"

Inheritance diagram for shared_model::interface::QueryResponseFactory:
Inheritance graph
Collaboration diagram for shared_model::interface::QueryResponseFactory:
Collaboration graph

Public Types

enum  ErrorQueryType {
  ErrorQueryType::kStatelessFailed, ErrorQueryType::kStatefulFailed, ErrorQueryType::kNoAccount, ErrorQueryType::kNoAccountAssets,
  ErrorQueryType::kNoAccountDetail, ErrorQueryType::kNoSignatories, ErrorQueryType::kNotSupported, ErrorQueryType::kNoAsset,
  ErrorQueryType::kNoRoles
}
 

Public Member Functions

virtual ~QueryResponseFactory ()=default
 
virtual std::unique_ptr< QueryResponsecreateAccountAssetResponse (std::vector< std::tuple< types::AccountIdType, types::AssetIdType, shared_model::interface::Amount >> assets, size_t total_assets_number, boost::optional< shared_model::interface::types::AssetIdType > next_asset_id, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateAccountDetailResponse (types::DetailType account_detail, size_t total_number, boost::optional< shared_model::interface::types::AccountDetailRecordId > next_record_id, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateAccountResponse (interface::types::AccountIdType account_id, interface::types::DomainIdType domain_id, interface::types::QuorumType quorum, interface::types::JsonType jsonData, std::vector< std::string > roles, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateBlockResponse (std::unique_ptr< Block > block, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateErrorQueryResponse (ErrorQueryType error_type, ErrorQueryResponse::ErrorMessageType error_msg, ErrorQueryResponse::ErrorCodeType error_code, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateSignatoriesResponse (std::vector< types::PubkeyType > signatories, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateTransactionsResponse (std::vector< std::unique_ptr< shared_model::interface::Transaction >> transactions, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateTransactionsPageResponse (std::vector< std::unique_ptr< shared_model::interface::Transaction >> transactions, const crypto::Hash &next_tx_hash, interface::types::TransactionsNumberType all_transactions_size, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateTransactionsPageResponse (std::vector< std::unique_ptr< shared_model::interface::Transaction >> transactions, interface::types::TransactionsNumberType all_transactions_size, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreatePendingTransactionsPageResponse (std::vector< std::unique_ptr< interface::Transaction >> transactions, interface::types::TransactionsNumberType all_transactions_size, boost::optional< interface::PendingTransactionsPageResponse::BatchInfo > next_batch_info, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateAssetResponse (types::AssetIdType asset_id, types::DomainIdType domain_id, types::PrecisionType precision, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateRolesResponse (std::vector< types::RoleIdType > roles, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< QueryResponsecreateRolePermissionsResponse (RolePermissionSet role_permissions, const crypto::Hash &query_hash) const =0
 
virtual std::unique_ptr< BlockQueryResponsecreateBlockQueryResponse (std::shared_ptr< const Block > block) const =0
 
virtual std::unique_ptr< BlockQueryResponsecreateBlockQueryResponse (std::string error_message) const =0
 

Detailed Description

Factory for building query responses

Member Enumeration Documentation

Describes type of error to be placed inside the error query response

Enumerator
kStatelessFailed 
kStatefulFailed 
kNoAccount 
kNoAccountAssets 
kNoAccountDetail 
kNoSignatories 
kNotSupported 
kNoAsset 
kNoRoles 

Constructor & Destructor Documentation

virtual shared_model::interface::QueryResponseFactory::~QueryResponseFactory ( )
virtualdefault

Member Function Documentation

virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createAccountAssetResponse ( std::vector< std::tuple< types::AccountIdType, types::AssetIdType, shared_model::interface::Amount >>  assets,
size_t  total_assets_number,
boost::optional< shared_model::interface::types::AssetIdType next_asset_id,
const crypto::Hash query_hash 
) const
pure virtual

Create response for account asset query

Parameters
assetsto be inserted into the response
total_assets_numberthe number of all assets as opposed to the page size
next_asset_idif there are more assets ofter the provided ones, this specifies the id of the first following asset; otherwise none
query_hash- hash of the query, for which response is created
Returns
account asset response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createAccountDetailResponse ( types::DetailType  account_detail,
size_t  total_number,
boost::optional< shared_model::interface::types::AccountDetailRecordId next_record_id,
const crypto::Hash query_hash 
) const
pure virtual

Create response for account detail query

Parameters
account_detailto be inserted into the response
total_numberthe total number of detail records matching the query, regardless of pagination metadata
next_record_idthe next record id, if any
query_hash- hash of the query, for which response is created
Returns
account detail response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createAccountResponse ( interface::types::AccountIdType  account_id,
interface::types::DomainIdType  domain_id,
interface::types::QuorumType  quorum,
interface::types::JsonType  jsonData,
std::vector< std::string >  roles,
const crypto::Hash query_hash 
) const
pure virtual

Create response for account query

Parameters
account_idof account to be inserted into the response
domain_idof account to be inserted into the response
quorumof account to be inserted into the response
jsonDataof account to be inserted into the response
rolesto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
account response

Implemented in shared_model::proto::ProtoQueryResponseFactory.

virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createAssetResponse ( types::AssetIdType  asset_id,
types::DomainIdType  domain_id,
types::PrecisionType  precision,
const crypto::Hash query_hash 
) const
pure virtual

Create response for asset query

Parameters
asset_idof asset to be inserted into the response
domain_idof asset to be inserted into the response
precisionof asset to be inserted into the response
query_hash- hash of the query, for which response is created
Returns
asset response

Implemented in shared_model::proto::ProtoQueryResponseFactory.

virtual std::unique_ptr<BlockQueryResponse> shared_model::interface::QueryResponseFactory::createBlockQueryResponse ( std::shared_ptr< const Block block) const
pure virtual

Create response for block query with block

Parameters
blockto be inserted into the response
Returns
block query response with block
virtual std::unique_ptr<BlockQueryResponse> shared_model::interface::QueryResponseFactory::createBlockQueryResponse ( std::string  error_message) const
pure virtual

Create response for block query with error

Parameters
error_messageto be inserted into the response
Returns
block query response with error

Implemented in shared_model::proto::ProtoQueryResponseFactory.

virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createBlockResponse ( std::unique_ptr< Block block,
const crypto::Hash query_hash 
) const
pure virtual

Create response for get block query

Parameters
blockto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
block response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createErrorQueryResponse ( ErrorQueryType  error_type,
ErrorQueryResponse::ErrorMessageType  error_msg,
ErrorQueryResponse::ErrorCodeType  error_code,
const crypto::Hash query_hash 
) const
pure virtual

Create response for failed query

Parameters
error_type- type of error to be inserted into the response
error_msg- message, which is to be set in the response
error_code- stateful error code to be set in the response
query_hash- hash of the query, for which response is created
Returns
error response

Implemented in shared_model::proto::ProtoQueryResponseFactory.

virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createPendingTransactionsPageResponse ( std::vector< std::unique_ptr< interface::Transaction >>  transactions,
interface::types::TransactionsNumberType  all_transactions_size,
boost::optional< interface::PendingTransactionsPageResponse::BatchInfo next_batch_info,
const crypto::Hash query_hash 
) const
pure virtual

Create paged response for pending transaction query

Parameters
transactions- list of transactions on the page
all_transactions_size- total number of transactions among all the batches in a pending storage for the user
next_batch_info- optional struct with hash of the first transaction for the following batch and its size (if exists)
query_hash- hash of the corresponding query
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createRolePermissionsResponse ( RolePermissionSet  role_permissions,
const crypto::Hash query_hash 
) const
pure virtual

Create response for role permissions query

Parameters
role_permissionsto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
role permissions response

Implemented in shared_model::proto::ProtoQueryResponseFactory.

virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createRolesResponse ( std::vector< types::RoleIdType roles,
const crypto::Hash query_hash 
) const
pure virtual

Create response for roles query

Parameters
rolesto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
roles response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createSignatoriesResponse ( std::vector< types::PubkeyType signatories,
const crypto::Hash query_hash 
) const
pure virtual

Create response for signatories query

Parameters
signatoriesto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
signatories response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createTransactionsPageResponse ( std::vector< std::unique_ptr< shared_model::interface::Transaction >>  transactions,
const crypto::Hash next_tx_hash,
interface::types::TransactionsNumberType  all_transactions_size,
const crypto::Hash query_hash 
) const
pure virtual

Create response for transactions pagination query

Parameters
transactions- list of transactions in this page
next_tx_hash- hash of the transaction after the last in the page
all_transactions_size- total number of transactions for this query
query_hash- hash of the query, for which response is created
Returns
transactions response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createTransactionsPageResponse ( std::vector< std::unique_ptr< shared_model::interface::Transaction >>  transactions,
interface::types::TransactionsNumberType  all_transactions_size,
const crypto::Hash query_hash 
) const
pure virtual

Create response for transactions pagination query without next hash

Parameters
transactions- list of transactions in this page
all_transactions_size- total number of transactions for this query
query_hash- hash of the query, for which response is created
Returns
transactions response
virtual std::unique_ptr<QueryResponse> shared_model::interface::QueryResponseFactory::createTransactionsResponse ( std::vector< std::unique_ptr< shared_model::interface::Transaction >>  transactions,
const crypto::Hash query_hash 
) const
pure virtual

Create response for transactions query

Parameters
transactionsto be inserted into the response
query_hash- hash of the query, for which response is created
Returns
transactions response

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