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

#include "rocksdb_block_storage.hpp"

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

Public Member Functions

 RocksDbBlockStorage (std::shared_ptr< RocksDBContext > db_context, std::shared_ptr< shared_model::interface::BlockJsonConverter > json_converter, logger::LoggerPtr log)
 
bool insert (std::shared_ptr< const shared_model::interface::Block > block) override
 
boost::optional< std::unique_ptr< shared_model::interface::Block > > fetch (shared_model::interface::types::HeightType height) const override
 
size_t size () const override
 
void reload () override
 
void clear () override
 
expected::Result< void, std::string > forEach (FunctionType function) const override
 
- Public Member Functions inherited from iroha::ametsuchi::BlockStorage
virtual ~BlockStorage ()=default
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ RocksDbBlockStorage()

RocksDbBlockStorage::RocksDbBlockStorage ( std::shared_ptr< RocksDBContext db_context,
std::shared_ptr< shared_model::interface::BlockJsonConverter json_converter,
logger::LoggerPtr  log 
)

Member Function Documentation

◆ clear()

void RocksDbBlockStorage::clear ( )
overridevirtual

Clears the contents of storage

Implements iroha::ametsuchi::BlockStorage.

Here is the call graph for this function:

◆ fetch()

boost::optional< std::unique_ptr< shared_model::interface::Block > > RocksDbBlockStorage::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:

◆ forEach()

iroha::expected::Result< void, std::string > RocksDbBlockStorage::forEach ( FunctionType  function) const
overridevirtual

Iterates through all the stored blocks

Implements iroha::ametsuchi::BlockStorage.

Here is the call graph for this function:

◆ insert()

bool RocksDbBlockStorage::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.

◆ reload()

void RocksDbBlockStorage::reload ( )
overridevirtual

Reloads blocks in case their were modified externally

Implements iroha::ametsuchi::BlockStorage.

◆ size()

size_t RocksDbBlockStorage::size ( ) const
overridevirtual

Returns the size of the storage

Implements iroha::ametsuchi::BlockStorage.

Here is the caller graph for this function:

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