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

#include "storage_impl.hpp"

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

Public Member Functions

expected::Result< std::unique_ptr< CommandExecutor >, std::string > createCommandExecutor () override
 
std::unique_ptr< TemporaryWsvcreateTemporaryWsv (std::shared_ptr< CommandExecutor > command_executor) override
 
boost::optional< std::unique_ptr< SettingQuery > > createSettingQuery () const override
 
iroha::expected::Result< std::unique_ptr< QueryExecutor >, std::string > createQueryExecutor (std::shared_ptr< PendingTransactionStorage > pending_txs_storage, std::shared_ptr< shared_model::interface::QueryResponseFactory > response_factory) const override
 
expected::Result< void, std::string > insertPeer (const shared_model::interface::Peer &peer) override
 
iroha::expected::Result< std::unique_ptr< MutableStorage >, std::string > createMutableStorage (std::shared_ptr< CommandExecutor > command_executor, BlockStorageFactory &storage_factory) override
 
expected::Result< std::unique_ptr< MutableStorage >, std::string > createMutableStorage (std::shared_ptr< CommandExecutor > command_executor) override
 
expected::Result< void, std::string > resetPeers () override
 
void freeConnections () override
 
CommitResult commitPrepared (std::shared_ptr< const shared_model::interface::Block > block) override
 
std::shared_ptr< WsvQuerygetWsvQuery () const override
 
std::shared_ptr< BlockQuerygetBlockQuery () const override
 
void prepareBlock (std::unique_ptr< TemporaryWsv > wsv) override
 
 ~StorageImpl () override
 
- Public Member Functions inherited from iroha::ametsuchi::StorageBase
 StorageBase (StorageBase &&)=delete
 
 StorageBase (StorageBase const &)=delete
 
StorageBaseoperator= (StorageBase &&)=delete
 
StorageBaseoperator= (StorageBase const &)=delete
 
boost::optional< std::shared_ptr< PeerQuery > > createPeerQuery () const override
 
bool preparedCommitEnabled () const override
 Check if prepared commits are enabled. More...
 
boost::optional< std::shared_ptr< BlockQuery > > createBlockQuery () const override
 
logger::LoggerManagerTreePtr logManager () const
 
auto & blockIsPrepared ()
 
std::shared_ptr< BlockStorageblockStore () const
 
std::shared_ptr< shared_model::interface::PermissionToStringpermConverter () const
 
logger::LoggerPtr log () const
 
std::shared_ptr< PendingTransactionStoragependingTxStorage () const
 
auto & temporaryBlockStorageFactory ()
 
std::shared_ptr< shared_model::interface::QueryResponseFactoryqueryResponseFactory () const
 
std::optional< std::reference_wrapper< const VmCaller > > vmCaller () const
 
boost::optional< std::shared_ptr< const iroha::LedgerState > > ledgerState () const
 
void ledgerState (boost::optional< std::shared_ptr< const iroha::LedgerState >> const &value)
 
expected::Result< void, std::string > insertBlock (std::shared_ptr< const shared_model::interface::Block > block) override
 
expected::Result< void, std::string > dropBlockStorage () override
 
boost::optional< std::shared_ptr< const iroha::LedgerState > > getLedgerState () const override
 
CommitResult commit (std::unique_ptr< MutableStorage > mutable_storage) override
 
void prepareBlockImpl (std::unique_ptr< TemporaryWsv > wsv, DatabaseTransaction &db_context)
 
StoreBlockResult storeBlock (std::shared_ptr< const shared_model::interface::Block > block)
 
 StorageBase (boost::optional< std::shared_ptr< const iroha::LedgerState >> ledger_state, std::shared_ptr< BlockStorage > block_store, std::shared_ptr< shared_model::interface::PermissionToString > perm_converter, std::shared_ptr< PendingTransactionStorage > pending_txs_storage, std::shared_ptr< shared_model::interface::QueryResponseFactory > query_response_factory, std::unique_ptr< BlockStorageFactory > temporary_block_storage_factory, std::optional< std::reference_wrapper< const VmCaller >> vm_caller_ref, logger::LoggerManagerTreePtr log_manager, std::string const &prepared_block_name, std::function< void(std::shared_ptr< shared_model::interface::Block const >)> callback, bool prepared_blocks_enabled)
 
 ~StorageBase ()
 
- Public Member Functions inherited from iroha::ametsuchi::Storage
virtual ~Storage ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::TemporaryFactory
virtual ~TemporaryFactory ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::MutableFactory
virtual ~MutableFactory ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::PeerQueryFactory
virtual ~PeerQueryFactory ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::BlockQueryFactory
virtual ~BlockQueryFactory ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::QueryExecutorFactory
virtual ~QueryExecutorFactory ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::SettingQueryFactory
virtual ~SettingQueryFactory ()=default
 

Static Public Member Functions

static expected::Result< std::shared_ptr< StorageImpl >, std::string > create (const PostgresOptions &postgres_options, std::shared_ptr< PoolWrapper > pool_wrapper, std::shared_ptr< shared_model::interface::PermissionToString > perm_converter, std::shared_ptr< PendingTransactionStorage > pending_txs_storage, std::shared_ptr< shared_model::interface::QueryResponseFactory > query_response_factory, std::unique_ptr< BlockStorageFactory > temporary_block_storage_factory, std::shared_ptr< BlockStorage > persistent_block_storage, std::optional< std::reference_wrapper< const VmCaller >> vm_caller_ref, std::function< void(std::shared_ptr< shared_model::interface::Block const >)> callback, logger::LoggerManagerTreePtr log_manager, size_t pool_size=10)
 

Protected Member Functions

 StorageImpl (boost::optional< std::shared_ptr< const iroha::LedgerState >> ledger_state, const PostgresOptions &postgres_options, std::shared_ptr< BlockStorage > block_store, std::shared_ptr< PoolWrapper > pool_wrapper, std::shared_ptr< shared_model::interface::PermissionToString > perm_converter, std::shared_ptr< PendingTransactionStorage > pending_txs_storage, std::shared_ptr< shared_model::interface::QueryResponseFactory > query_response_factory, std::unique_ptr< BlockStorageFactory > temporary_block_storage_factory, size_t pool_size, std::optional< std::reference_wrapper< const VmCaller >> vm_caller, std::function< void(std::shared_ptr< shared_model::interface::Block const >)> callback, logger::LoggerManagerTreePtr log_manager)
 
- Protected Member Functions inherited from iroha::ametsuchi::StorageBase
CommitResult commitPreparedImpl (std::shared_ptr< const shared_model::interface::Block > block, DatabaseTransaction &db_context, WsvCommand &wsv_command, WsvQuery &wsv_query, std::unique_ptr< Indexer > indexer)
 

Friends

class ::iroha::ametsuchi::AmetsuchiTest
 

Additional Inherited Members

- Public Types inherited from iroha::ametsuchi::StorageBase
using StoreBlockResult = iroha::expected::Result< void, std::string >
 

Constructor & Destructor Documentation

◆ ~StorageImpl()

iroha::ametsuchi::StorageImpl::~StorageImpl ( )
override
Here is the call graph for this function:

◆ StorageImpl()

iroha::ametsuchi::StorageImpl::StorageImpl ( boost::optional< std::shared_ptr< const iroha::LedgerState >>  ledger_state,
const PostgresOptions postgres_options,
std::shared_ptr< BlockStorage block_store,
std::shared_ptr< PoolWrapper pool_wrapper,
std::shared_ptr< shared_model::interface::PermissionToString perm_converter,
std::shared_ptr< PendingTransactionStorage pending_txs_storage,
std::shared_ptr< shared_model::interface::QueryResponseFactory query_response_factory,
std::unique_ptr< BlockStorageFactory temporary_block_storage_factory,
size_t  pool_size,
std::optional< std::reference_wrapper< const VmCaller >>  vm_caller,
std::function< void(std::shared_ptr< shared_model::interface::Block const >)>  callback,
logger::LoggerManagerTreePtr  log_manager 
)
protected
Here is the caller graph for this function:

Member Function Documentation

◆ commitPrepared()

CommitResult iroha::ametsuchi::StorageImpl::commitPrepared ( std::shared_ptr< const shared_model::interface::Block block)
overridevirtual

Try to apply prepared block to Ametsuchi.

Parameters
blockThe previously prepared block that will be committed now.
Returns
Result of committing the prepared block.

Implements iroha::ametsuchi::MutableFactory.

Here is the call graph for this function:

◆ create()

expected::Result< std::shared_ptr< StorageImpl >, std::string > iroha::ametsuchi::StorageImpl::create ( const PostgresOptions postgres_options,
std::shared_ptr< PoolWrapper pool_wrapper,
std::shared_ptr< shared_model::interface::PermissionToString perm_converter,
std::shared_ptr< PendingTransactionStorage pending_txs_storage,
std::shared_ptr< shared_model::interface::QueryResponseFactory query_response_factory,
std::unique_ptr< BlockStorageFactory temporary_block_storage_factory,
std::shared_ptr< BlockStorage persistent_block_storage,
std::optional< std::reference_wrapper< const VmCaller >>  vm_caller_ref,
std::function< void(std::shared_ptr< shared_model::interface::Block const >)>  callback,
logger::LoggerManagerTreePtr  log_manager,
size_t  pool_size = 10 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createCommandExecutor()

expected::Result< std::unique_ptr< CommandExecutor >, std::string > iroha::ametsuchi::StorageImpl::createCommandExecutor ( )
overridevirtual

Create new command executor that holds a database session within.

Returns
The command executor or string error message.

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:

◆ createMutableStorage() [1/2]

expected::Result< std::unique_ptr< MutableStorage >, std::string > iroha::ametsuchi::StorageImpl::createMutableStorage ( std::shared_ptr< CommandExecutor command_executor,
BlockStorageFactory storage_factory 
)
overridevirtual

Creates a mutable storage from the current state

Returns
Created mutable storage.

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createMutableStorage() [2/2]

expected::Result< std::unique_ptr< MutableStorage >, std::string > iroha::ametsuchi::StorageImpl::createMutableStorage ( std::shared_ptr< CommandExecutor command_executor)
overridevirtual

Creates a mutable storage from the current state. Mutable storage is the only way to commit the block to the ledger.

Returns
Created mutable storage

Implements iroha::ametsuchi::MutableFactory.

Here is the call graph for this function:

◆ createQueryExecutor()

iroha::expected::Result< std::unique_ptr< QueryExecutor >, std::string > iroha::ametsuchi::StorageImpl::createQueryExecutor ( std::shared_ptr< PendingTransactionStorage pending_txs_storage,
std::shared_ptr< shared_model::interface::QueryResponseFactory response_factory 
) const
overridevirtual

Creates a query executor from the current state

Implements iroha::ametsuchi::QueryExecutorFactory.

Here is the call graph for this function:

◆ createSettingQuery()

boost::optional< std::unique_ptr< SettingQuery > > iroha::ametsuchi::StorageImpl::createSettingQuery ( ) const
overridevirtual

Creates a setting query

Returns
Created setting query

Implements iroha::ametsuchi::SettingQueryFactory.

Here is the call graph for this function:

◆ createTemporaryWsv()

std::unique_ptr< TemporaryWsv > iroha::ametsuchi::StorageImpl::createTemporaryWsv ( std::shared_ptr< CommandExecutor command_executor)
overridevirtual

Creates a temporary world state view from the current state. Temporary state will be not committed and will be erased on destructor call. Temporary state might be used for transaction validation.

Returns
Created temporary wsv.

Implements iroha::ametsuchi::TemporaryFactory.

Here is the call graph for this function:

◆ freeConnections()

void iroha::ametsuchi::StorageImpl::freeConnections ( )
overridevirtual

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBlockQuery()

std::shared_ptr< BlockQuery > iroha::ametsuchi::StorageImpl::getBlockQuery ( ) const
overridevirtual

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:

◆ getWsvQuery()

std::shared_ptr< WsvQuery > iroha::ametsuchi::StorageImpl::getWsvQuery ( ) const
overridevirtual

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:

◆ insertPeer()

expected::Result< void, std::string > iroha::ametsuchi::StorageImpl::insertPeer ( const shared_model::interface::Peer peer)
overridevirtual

Insert a peer into WSV

Parameters
peer- peer to insert
Returns
error reason if not inserted

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:

◆ prepareBlock()

void iroha::ametsuchi::StorageImpl::prepareBlock ( std::unique_ptr< TemporaryWsv wsv)
overridevirtual

Prepare state which was accumulated in temporary WSV. After preparation, this state is not visible until commited.

Parameters
wsv- state which will be prepared.

Implements iroha::ametsuchi::TemporaryFactory.

Here is the call graph for this function:

◆ resetPeers()

iroha::expected::Result< void, std::string > iroha::ametsuchi::StorageImpl::resetPeers ( )
overridevirtual

Removes all peers from WSV

Implements iroha::ametsuchi::Storage.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ ::iroha::ametsuchi::AmetsuchiTest

friend class ::iroha::ametsuchi::AmetsuchiTest
friend

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