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

#include "postgres_block_query.hpp"

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

Public Member Functions

 PostgresBlockQuery (soci::session &sql, KeyValueStorage &file_store, std::shared_ptr< shared_model::interface::BlockJsonDeserializer > converter, logger::LoggerPtr log)
 
 PostgresBlockQuery (std::unique_ptr< soci::session > sql, KeyValueStorage &file_store, std::shared_ptr< shared_model::interface::BlockJsonDeserializer > converter, logger::LoggerPtr log)
 
std::vector< wBlockgetBlocks (shared_model::interface::types::HeightType height, uint32_t count) override
 
std::vector< wBlockgetBlocksFrom (shared_model::interface::types::HeightType height) override
 
std::vector< wBlockgetTopBlocks (uint32_t count) override
 
uint32_t getTopBlockHeight () override
 
boost::optional< TxCacheStatusTypecheckTxPresence (const shared_model::crypto::Hash &hash) override
 
expected::Result< wBlock, std::string > getTopBlock () override
 
- Public Member Functions inherited from iroha::ametsuchi::BlockQuery
virtual ~BlockQuery ()=default
 

Additional Inherited Members

- Protected Types inherited from iroha::ametsuchi::BlockQuery
using wTransaction = std::shared_ptr< shared_model::interface::Transaction >
 
using wBlock = std::shared_ptr< shared_model::interface::Block >
 

Detailed Description

Class which implements BlockQuery with a Postgres backend.

Constructor & Destructor Documentation

iroha::ametsuchi::PostgresBlockQuery::PostgresBlockQuery ( soci::session &  sql,
KeyValueStorage file_store,
std::shared_ptr< shared_model::interface::BlockJsonDeserializer converter,
logger::LoggerPtr  log 
)
iroha::ametsuchi::PostgresBlockQuery::PostgresBlockQuery ( std::unique_ptr< soci::session >  sql,
KeyValueStorage file_store,
std::shared_ptr< shared_model::interface::BlockJsonDeserializer converter,
logger::LoggerPtr  log 
)

Member Function Documentation

boost::optional< TxCacheStatusType > iroha::ametsuchi::PostgresBlockQuery::checkTxPresence ( const shared_model::crypto::Hash hash)
overridevirtual

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

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:

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

Get given number of blocks starting with given height.

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

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Get all blocks starting from given height.

Parameters
from- starting height
Returns
observable of Model Block

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:

expected::Result< BlockQuery::wBlock, std::string > iroha::ametsuchi::PostgresBlockQuery::getTopBlock ( )
overridevirtual

Get the top-most block

Returns
result of Model Block or error message

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:

uint32_t iroha::ametsuchi::PostgresBlockQuery::getTopBlockHeight ( )
overridevirtual

Get height of the top block.

Returns
height

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:

std::vector< BlockQuery::wBlock > iroha::ametsuchi::PostgresBlockQuery::getTopBlocks ( uint32_t  count)
overridevirtual

Get given number of blocks from top.

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

Implements iroha::ametsuchi::BlockQuery.

Here is the call graph for this function:


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