hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
query_response_factory.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_QUERY_RESPONSE_FACTORY_HPP
7 #define IROHA_QUERY_RESPONSE_FACTORY_HPP
8 
9 #include <memory>
10 
17 
18 namespace shared_model {
19  namespace crypto {
20  class Hash;
21  }
22  namespace interface {
23  class Block;
24  class Amount;
25  } // namespace interface
26 } // namespace shared_model
27 
28 namespace shared_model {
29  namespace interface {
30 
35  public:
36  virtual ~QueryResponseFactory() = default;
37 
44  virtual std::unique_ptr<QueryResponse> createAccountAssetResponse(
45  std::vector<std::tuple<types::AccountIdType,
48  const crypto::Hash &query_hash) const = 0;
49 
56  virtual std::unique_ptr<QueryResponse> createAccountDetailResponse(
57  types::DetailType account_detail,
58  const crypto::Hash &query_hash) const = 0;
59 
70  virtual std::unique_ptr<QueryResponse> createAccountResponse(
75  std::vector<std::string> roles,
76  const crypto::Hash &query_hash) const = 0;
77 
84  virtual std::unique_ptr<QueryResponse> createBlockResponse(
85  std::unique_ptr<Block> block,
86  const crypto::Hash &query_hash) const = 0;
87 
91  enum class ErrorQueryType {
92  kStatelessFailed,
93  kStatefulFailed,
94  kNoAccount,
95  kNoAccountAssets,
96  kNoAccountDetail,
97  kNoSignatories,
98  kNotSupported,
99  kNoAsset,
100  kNoRoles
101  };
110  virtual std::unique_ptr<QueryResponse> createErrorQueryResponse(
111  ErrorQueryType error_type,
114  const crypto::Hash &query_hash) const = 0;
115 
122  virtual std::unique_ptr<QueryResponse> createSignatoriesResponse(
123  std::vector<types::PubkeyType> signatories,
124  const crypto::Hash &query_hash) const = 0;
125 
132  virtual std::unique_ptr<QueryResponse> createTransactionsResponse(
133  std::vector<std::unique_ptr<shared_model::interface::Transaction>>
134  transactions,
135  const crypto::Hash &query_hash) const = 0;
136 
147  virtual std::unique_ptr<QueryResponse> createTransactionsPageResponse(
148  std::vector<std::unique_ptr<shared_model::interface::Transaction>>
149  transactions,
150  const crypto::Hash &next_tx_hash,
151  interface::types::TransactionsNumberType all_transactions_size,
152  const crypto::Hash &query_hash) const = 0;
153 
162  virtual std::unique_ptr<QueryResponse> createTransactionsPageResponse(
163  std::vector<std::unique_ptr<shared_model::interface::Transaction>>
164  transactions,
165  interface::types::TransactionsNumberType all_transactions_size,
166  const crypto::Hash &query_hash) const = 0;
167 
176  virtual std::unique_ptr<QueryResponse> createAssetResponse(
177  types::AssetIdType asset_id,
178  types::DomainIdType domain_id,
179  types::PrecisionType precision,
180  const crypto::Hash &query_hash) const = 0;
181 
188  virtual std::unique_ptr<QueryResponse> createRolesResponse(
189  std::vector<types::RoleIdType> roles,
190  const crypto::Hash &query_hash) const = 0;
191 
198  virtual std::unique_ptr<QueryResponse> createRolePermissionsResponse(
199  RolePermissionSet role_permissions,
200  const crypto::Hash &query_hash) const = 0;
201 
207  virtual std::unique_ptr<BlockQueryResponse> createBlockQueryResponse(
208  std::shared_ptr<const Block> block) const = 0;
209 
215  virtual std::unique_ptr<BlockQueryResponse> createBlockQueryResponse(
216  std::string error_message) const = 0;
217  };
218 
219  } // namespace interface
220 } // namespace shared_model
221 
222 #endif // IROHA_QUERY_RESPONSE_FACTORY_HPP
Definition: hash.hpp:18
std::string ErrorMessageType
Message type.
Definition: error_query_response.hpp:56
std::string DomainIdType
Iroha domain id type.
Definition: types.hpp:49
Definition: permissions.hpp:92
Definition: amount.hpp:20
Definition: query_response_factory.hpp:34
std::string DetailType
Type of detail.
Definition: types.hpp:69
std::string AccountIdType
Type of account id.
Definition: types.hpp:35
ErrorQueryType
Definition: query_response_factory.hpp:91
uint8_t PrecisionType
Type of precision.
Definition: types.hpp:37
uint32_t ErrorCodeType
Error code type.
Definition: error_query_response.hpp:64
uint16_t TransactionsNumberType
Type of a number of transactions in block and query response page.
Definition: types.hpp:77
Definition: command_executor.hpp:12
uint16_t QuorumType
Type of Quorum used in transaction and set quorum.
Definition: types.hpp:57
std::string JsonType
Type of JSON data.
Definition: types.hpp:71
std::string AssetIdType
Type of asset id.
Definition: types.hpp:51