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

#include "block_storage.hpp"

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

Public Types

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

virtual bool insert (std::shared_ptr< const shared_model::interface::Block > block)=0
 
virtual boost::optional< std::shared_ptr< const shared_model::interface::Block > > fetch (shared_model::interface::types::HeightType height) const =0
 
virtual size_t size () const =0
 
virtual void clear ()=0
 
virtual void forEach (FunctionType function) const =0
 
virtual ~BlockStorage ()=default
 

Detailed Description

Append-only block storage interface

Member Typedef Documentation

using iroha::ametsuchi::BlockStorage::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

Constructor & Destructor Documentation

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

Member Function Documentation

virtual void iroha::ametsuchi::BlockStorage::clear ( )
pure virtual
virtual boost::optional< std::shared_ptr<const shared_model::interface::Block> > iroha::ametsuchi::BlockStorage::fetch ( shared_model::interface::types::HeightType  height) const
pure virtual

Get block with given height

Returns
block if exists, boost::none otherwise

Implemented in iroha::ametsuchi::PostgresBlockStorage, iroha::ametsuchi::FlatFileBlockStorage, and iroha::ametsuchi::InMemoryBlockStorage.

virtual void iroha::ametsuchi::BlockStorage::forEach ( FunctionType  function) const
pure virtual
virtual bool iroha::ametsuchi::BlockStorage::insert ( std::shared_ptr< const shared_model::interface::Block block)
pure virtual

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

Returns
true if inserted successfully, false otherwise

Implemented in iroha::ametsuchi::PostgresBlockStorage, iroha::ametsuchi::FlatFileBlockStorage, and iroha::ametsuchi::InMemoryBlockStorage.

virtual size_t iroha::ametsuchi::BlockStorage::size ( ) const
pure virtual

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