referrerpolicy=no-referrer-when-downgrade
sc_consensus_epochs

Trait Epoch

Source
pub trait Epoch: Debug {
    type NextEpochDescriptor;
    type Slot: Ord + Copy + Debug;

    // Required methods
    fn start_slot(&self) -> Self::Slot;
    fn end_slot(&self) -> Self::Slot;
    fn increment(&self, descriptor: Self::NextEpochDescriptor) -> Self;
}
Expand description

Epoch data, distinguish whether it is genesis or not.

Once an epoch is created, it must have a known start_slot and end_slot, which cannot be changed. Consensus engine may modify any other data in the epoch, if needed.

Required Associated Types§

Source

type NextEpochDescriptor

Descriptor for the next epoch.

Source

type Slot: Ord + Copy + Debug

Type of the slot number.

Required Methods§

Source

fn start_slot(&self) -> Self::Slot

The starting slot of the epoch.

Source

fn end_slot(&self) -> Self::Slot

Produce the “end slot” of the epoch. This is NOT inclusive to the epoch, i.e. the slots covered by the epoch are self.start_slot() .. self.end_slot().

Source

fn increment(&self, descriptor: Self::NextEpochDescriptor) -> Self

Increment the epoch data, using the next epoch descriptor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl Epoch for Epoch