Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::BabeUtil Class Referenceabstract

#include <babe_util.hpp>

Inheritance diagram for kagome::consensus::BabeUtil:
Collaboration diagram for kagome::consensus::BabeUtil:

Public Member Functions

virtual ~BabeUtil ()=default
 
virtual BabeSlotNumber syncEpoch (std::function< std::tuple< BabeSlotNumber, bool >()> &&f)=0
 
virtual BabeSlotNumber getCurrentSlot () const =0
 
virtual BabeTimePoint slotStartTime (BabeSlotNumber slot) const =0
 
virtual BabeDuration remainToStartOfSlot (BabeSlotNumber slot) const =0
 
virtual BabeTimePoint slotFinishTime (BabeSlotNumber slot) const =0
 
virtual BabeDuration remainToFinishOfSlot (BabeSlotNumber slot) const =0
 
virtual EpochNumber slotToEpoch (BabeSlotNumber slot_number) const =0
 
virtual BabeSlotNumber slotInEpoch (BabeSlotNumber slot_number) const =0
 

Detailed Description

Auxiliary class to calculate epoch index by slot number. It needed as seperated class because to exclude mutual dependency blockchain mechanic and block production/validation.

Definition at line 19 of file babe_util.hpp.

Constructor & Destructor Documentation

virtual kagome::consensus::BabeUtil::~BabeUtil ( )
virtualdefault

Member Function Documentation

virtual BabeSlotNumber kagome::consensus::BabeUtil::getCurrentSlot ( ) const
pure virtual
Returns
current unix time slot number

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeDuration kagome::consensus::BabeUtil::remainToFinishOfSlot ( BabeSlotNumber  slot) const
pure virtual
Returns
duration to finish of slot #{
Parameters
slot}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeDuration kagome::consensus::BabeUtil::remainToStartOfSlot ( BabeSlotNumber  slot) const
pure virtual
Returns
duration to start of slot #{
Parameters
slot}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeTimePoint kagome::consensus::BabeUtil::slotFinishTime ( BabeSlotNumber  slot) const
pure virtual
Returns
timepoint of finish of slot #{
Parameters
slot}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeSlotNumber kagome::consensus::BabeUtil::slotInEpoch ( BabeSlotNumber  slot_number) const
pure virtual
Returns
ordinal number of the slot in the corresponding epoch by provided {
Parameters
slot_number}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeTimePoint kagome::consensus::BabeUtil::slotStartTime ( BabeSlotNumber  slot) const
pure virtual
Returns
timepoint of start of slot #{
Parameters
slot}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual EpochNumber kagome::consensus::BabeUtil::slotToEpoch ( BabeSlotNumber  slot_number) const
pure virtual
Returns
number of epoch by provided {
Parameters
slot_number}

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.

virtual BabeSlotNumber kagome::consensus::BabeUtil::syncEpoch ( std::function< std::tuple< BabeSlotNumber, bool >()> &&  f)
pure virtual

Init inner state by call {

Parameters
f}returning first block slot and flag if first block is already finalized

Implemented in kagome::consensus::babe::BabeConfigRepositoryImpl.


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