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

#include "block_query.hpp"

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

Public Member Functions

virtual ~BlockQuery ()=default
 
virtual std::vector< wBlockgetBlocks (shared_model::interface::types::HeightType height, uint32_t count)=0
 
virtual std::vector< wBlockgetBlocksFrom (shared_model::interface::types::HeightType height)=0
 
virtual std::vector< wBlockgetTopBlocks (uint32_t count)=0
 
virtual uint32_t getTopBlockHeight ()=0
 
virtual boost::optional< TxCacheStatusTypecheckTxPresence (const shared_model::crypto::Hash &hash)=0
 
virtual expected::Result< wBlock, std::stringgetTopBlock ()=0
 

Protected Types

using wTransaction = std::shared_ptr< shared_model::interface::Transaction >
 
using wBlock = std::shared_ptr< shared_model::interface::Block >
 

Detailed Description

Public interface for queries on blocks and transactions

Member Typedef Documentation

Constructor & Destructor Documentation

virtual iroha::ametsuchi::BlockQuery::~BlockQuery ( )
virtualdefault

Member Function Documentation

virtual boost::optional<TxCacheStatusType> iroha::ametsuchi::BlockQuery::checkTxPresence ( const shared_model::crypto::Hash hash)
pure virtual

Synchronously checks whether transaction with given hash is present in any block

Parameters
hash- transaction's hash
Returns
TxCacheStatusType which returns status (Committed, Rejected or Missing) of transaction if storage query was successful, boost::none otherwise

Implemented in iroha::ametsuchi::PostgresBlockQuery.

virtual std::vector<wBlock> iroha::ametsuchi::BlockQuery::getBlocks ( shared_model::interface::types::HeightType  height,
uint32_t  count 
)
pure virtual

Get given number of blocks starting with given height.

Parameters
height- starting height
count- number of blocks to retrieve
Returns
observable of Model Block

Implemented in iroha::ametsuchi::PostgresBlockQuery.

virtual std::vector<wBlock> iroha::ametsuchi::BlockQuery::getBlocksFrom ( shared_model::interface::types::HeightType  height)
pure virtual

Get all blocks starting from given height.

Parameters
from- starting height
Returns
observable of Model Block

Implemented in iroha::ametsuchi::PostgresBlockQuery.

virtual expected::Result<wBlock, std::string> iroha::ametsuchi::BlockQuery::getTopBlock ( )
pure virtual

Get the top-most block

Returns
result of Model Block or error message

Implemented in iroha::ametsuchi::PostgresBlockQuery.

virtual uint32_t iroha::ametsuchi::BlockQuery::getTopBlockHeight ( )
pure virtual

Get height of the top block.

Returns
height

Implemented in iroha::ametsuchi::PostgresBlockQuery.

virtual std::vector<wBlock> iroha::ametsuchi::BlockQuery::getTopBlocks ( uint32_t  count)
pure virtual

Get given number of blocks from top.

Parameters
count- number of blocks to retrieve
Returns
observable of Model Block

Implemented in iroha::ametsuchi::PostgresBlockQuery.


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