Kagome
Polkadot Runtime Engine in C++17
babe_util.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CONSENSUS_BABEUTIL
7 #define KAGOME_CONSENSUS_BABEUTIL
8 
11 
12 namespace kagome::consensus {
13 
19  class BabeUtil {
20  public:
21  virtual ~BabeUtil() = default;
22 
27  virtual BabeSlotNumber syncEpoch(
28  std::function<std::tuple<BabeSlotNumber, bool>()> &&f) = 0;
29 
33  virtual BabeSlotNumber getCurrentSlot() const = 0;
34 
38  virtual BabeTimePoint slotStartTime(BabeSlotNumber slot) const = 0;
39 
43  virtual BabeDuration remainToStartOfSlot(BabeSlotNumber slot) const = 0;
44 
48  virtual BabeTimePoint slotFinishTime(BabeSlotNumber slot) const = 0;
49 
53  virtual BabeDuration remainToFinishOfSlot(BabeSlotNumber slot) const = 0;
54 
58  virtual EpochNumber slotToEpoch(BabeSlotNumber slot_number) const = 0;
59 
64  virtual BabeSlotNumber slotInEpoch(BabeSlotNumber slot_number) const = 0;
65  };
66 
67 } // namespace kagome::consensus
68 #endif // KAGOME_CONSENSUS_BABEUTIL
virtual ~BabeUtil()=default
virtual BabeTimePoint slotFinishTime(BabeSlotNumber slot) const =0
virtual BabeTimePoint slotStartTime(BabeSlotNumber slot) const =0
virtual EpochNumber slotToEpoch(BabeSlotNumber slot_number) const =0
virtual BabeSlotNumber syncEpoch(std::function< std::tuple< BabeSlotNumber, bool >()> &&f)=0
BabeClock::TimePoint BabeTimePoint
BABE uses system clock&#39;s time points.
Definition: common.hpp:18
uint64_t BabeSlotNumber
slot number of the Babe production
Definition: common.hpp:24
virtual BabeSlotNumber getCurrentSlot() const =0
virtual BabeDuration remainToFinishOfSlot(BabeSlotNumber slot) const =0
uint64_t EpochNumber
number of the epoch in the Babe production
Definition: common.hpp:27
virtual BabeDuration remainToStartOfSlot(BabeSlotNumber slot) const =0
BabeClock::Duration BabeDuration
Definition: common.hpp:21
virtual BabeSlotNumber slotInEpoch(BabeSlotNumber slot_number) const =0