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

#include "postgres_block_storage.hpp"

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

Public Types

using BlockTransportFactory = shared_model::proto::ProtoBlockFactory
 
- Public Types inherited from iroha::ametsuchi::BlockStorage
using FunctionType = std::function< void(std::shared_ptr< const shared_model::interface::Block >)>
 type of function which can be applied to the elements of the storage More...
 

Public Member Functions

 PostgresBlockStorage (std::shared_ptr< PoolWrapper > pool_wrapper, std::shared_ptr< BlockTransportFactory > block_factory, std::string table, logger::LoggerPtr log)
 
bool insert (std::shared_ptr< const shared_model::interface::Block > block) override
 
boost::optional< std::shared_ptr< const shared_model::interface::Block > > fetch (shared_model::interface::types::HeightType height) const override
 
size_t size () const override
 
void clear () override
 
void forEach (FunctionType function) const override
 
- Public Member Functions inherited from iroha::ametsuchi::BlockStorage
virtual ~BlockStorage ()=default
 

Protected Attributes

std::shared_ptr< PoolWrapperpool_wrapper_
 
std::shared_ptr< BlockTransportFactoryblock_factory_
 
std::string table_
 
logger::LoggerPtr log_
 

Member Typedef Documentation

Constructor & Destructor Documentation

PostgresBlockStorage::PostgresBlockStorage ( std::shared_ptr< PoolWrapper pool_wrapper,
std::shared_ptr< BlockTransportFactory block_factory,
std::string  table,
logger::LoggerPtr  log 
)

Member Function Documentation

void PostgresBlockStorage::clear ( )
overridevirtual

Clears the contents of storage

Implements iroha::ametsuchi::BlockStorage.

boost::optional< std::shared_ptr< const shared_model::interface::Block > > PostgresBlockStorage::fetch ( shared_model::interface::types::HeightType  height) const
overridevirtual

Get block with given height

Returns
block if exists, boost::none otherwise

Implements iroha::ametsuchi::BlockStorage.

Here is the call graph for this function:

Here is the caller graph for this function:

void PostgresBlockStorage::forEach ( FunctionType  function) const
overridevirtual

Iterates through all the stored blocks

Implements iroha::ametsuchi::BlockStorage.

Here is the call graph for this function:

bool PostgresBlockStorage::insert ( std::shared_ptr< const shared_model::interface::Block block)
overridevirtual

Append block, if the storage doesn't already contain the same block

Returns
true if inserted successfully, false otherwise

Implements iroha::ametsuchi::BlockStorage.

size_t PostgresBlockStorage::size ( ) const
overridevirtual

Returns the size of the storage

Implements iroha::ametsuchi::BlockStorage.

Member Data Documentation

std::shared_ptr<BlockTransportFactory> iroha::ametsuchi::PostgresBlockStorage::block_factory_
protected
logger::LoggerPtr iroha::ametsuchi::PostgresBlockStorage::log_
protected
std::shared_ptr<PoolWrapper> iroha::ametsuchi::PostgresBlockStorage::pool_wrapper_
protected
std::string iroha::ametsuchi::PostgresBlockStorage::table_
protected

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