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

#include "mutable_storage.hpp"

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

Classes

struct  CommitResult
 

Public Types

using MutableStoragePredicate = std::function< bool(std::shared_ptr< const shared_model::interface::Block >, const LedgerState &)>
 

Public Member Functions

virtual bool apply (std::shared_ptr< const shared_model::interface::Block > block)=0
 
virtual bool applyIf (std::shared_ptr< const shared_model::interface::Block > block, MutableStoragePredicate predicate)=0
 
virtual expected::Result< MutableStorage::CommitResult, std::string > commit (BlockStorage &block_storage) &&=0
 
virtual ~MutableStorage ()=default
 

Detailed Description

Mutable storage is used apply blocks to the storage. Allows to query the world state view, transactions, and blocks.

Member Typedef Documentation

◆ MutableStoragePredicate

using iroha::ametsuchi::MutableStorage::MutableStoragePredicate = std::function<bool( std::shared_ptr<const shared_model::interface::Block>, const LedgerState &)>

Predicate type checking block Function parameters:

  • Block - block to be checked
  • LedgerState - the state of ledger on which the block is applied

Constructor & Destructor Documentation

◆ ~MutableStorage()

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

Member Function Documentation

◆ apply()

virtual bool iroha::ametsuchi::MutableStorage::apply ( std::shared_ptr< const shared_model::interface::Block block)
pure virtual

Applies block without additional validation function

See also
apply(block, function)

Implemented in iroha::ametsuchi::MutableStorageImpl.

◆ applyIf()

virtual bool iroha::ametsuchi::MutableStorage::applyIf ( std::shared_ptr< const shared_model::interface::Block block,
MutableStoragePredicate  predicate 
)
pure virtual

Applies a block to current mutable state using logic specified in function

Parameters
blockBlock to be applied
predicateChecks whether block is applicable prior to applying transactions
Returns
True if block was successfully applied, false otherwise.

Implemented in iroha::ametsuchi::MutableStorageImpl.

Here is the caller graph for this function:

◆ commit()

virtual expected::Result<MutableStorage::CommitResult, std::string> iroha::ametsuchi::MutableStorage::commit ( BlockStorage block_storage) &&
pure virtual

Apply the local changes made to this MutableStorage to block_storage and the global WSV.

Implemented in iroha::ametsuchi::MutableStorageImpl.


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