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

#include "mst_storage.hpp"

Inheritance diagram for iroha::MstStorage:
Inheritance graph
Collaboration diagram for iroha::MstStorage:
Collaboration graph

Public Member Functions

StateUpdateResult apply (const shared_model::crypto::PublicKey &target_peer_key, const MstState &new_state)
 
StateUpdateResult updateOwnState (const DataType &tx)
 
MstState getExpiredTransactions (const TimeType &current_time)
 
MstState getDiffState (const shared_model::crypto::PublicKey &target_peer_key, const TimeType &current_time)
 
MstState whatsNew (ConstRefState new_state) const
 
bool batchInStorage (const DataType &batch) const
 
virtual ~MstStorage ()=default
 

Protected Member Functions

 MstStorage (logger::Logger log=logger::log("MstStorage"))
 

Protected Attributes

logger::Logger log_
 

Detailed Description

MstStorage responsible for manage own and others MstStates. All methods of storage covered by mutex, because we assume that mutex possible to execute in concurrent environment.

Constructor & Destructor Documentation

virtual iroha::MstStorage::~MstStorage ( )
virtualdefault
iroha::MstStorage::MstStorage ( logger::Logger  log = logger::log("MstStorage"))
explicitprotected

Constructor provide initialization of protected fields, such as logger.

Member Function Documentation

StateUpdateResult iroha::MstStorage::apply ( const shared_model::crypto::PublicKey target_peer_key,
const MstState new_state 
)

Apply new state for peer

Parameters
target_peer_key- key for for updating state
new_state- state with new data
Returns
State with completed or updated batches General note: implementation of method covered by lock
bool iroha::MstStorage::batchInStorage ( const DataType batch) const

Check, if passed batch is in the storage

Parameters
batchto be checked
Returns
true, if batch is already in the storage, false otherwise
MstState iroha::MstStorage::getDiffState ( const shared_model::crypto::PublicKey target_peer_key,
const TimeType current_time 
)

Make state based on diff of own and target states. All expired transactions will be removed from diff.

Returns
difference between own and target state General note: implementation of method covered by lock
MstState iroha::MstStorage::getExpiredTransactions ( const TimeType current_time)

Remove expired transactions and return them

Returns
State with expired transactions General note: implementation of method covered by lock
StateUpdateResult iroha::MstStorage::updateOwnState ( const DataType tx)

Provide updating state of current peer with new transaction

Parameters
tx- new transaction for insertion in state
Returns
completed and updated mst states General note: implementation of method covered by lock
MstState iroha::MstStorage::whatsNew ( ConstRefState  new_state) const

Return diff between own and new state

Parameters
new_state- state with new data
Returns
state that contains new data with respect to own state General note: implementation of method covered by lock

Member Data Documentation

logger::Logger iroha::MstStorage::log_
protected

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