Skip to main content

ProtocolState

Struct ProtocolState 

Source
pub struct ProtocolState<const N: usize, const G: usize> {
Show 52 fields pub st: b6, pub sub: b2, pub args: Args, pub n: b5, pub id: b5, pub f: b5, pub quorum: b5, pub qbase: b24, pub mb_prepare: b32, pub mb_will_cert: b32, pub mb_will_commit: b32, pub mb_commit: b32, pub mb_certify_valid: b32, pub mb_certify: b32, pub mb_vc: b32, pub mb_vc_valid: b32, pub mb_newview: b32, pub mb_newview_valid: b32, pub view: b32, pub leader: b5, pub stop: bool, pub seq: b32, pub slot: b4, pub m: b32, pub local_wait: b32, pub issued: bool, pub bc_done: bool, pub wissued: bool, pub second: bool, pub prop: [b32; G], pub prop_valid: [bool; G], pub enq: b4, pub out_sent: bool, pub rem_sent: bool, pub slowed: bool, pub share_beat: b5, pub checked: [bool; N], pub good: b5, pub peer: b5, pub reading: bool, pub vbeats: b2, pub voted_k: b32, pub voted_m: b32, pub voted_phase: b2, pub rec: b5, pub rec_k: [b32; N], pub rec_m: [b32; N], pub rec_ok: [bool; N], pub nv_k: b32, pub nv_m: b32, pub status: Status, pub slot_start: b32,
}
Expand description

The controller’s registers. N is the most replicas the build supports, G the window.

Fields§

§st: b6

State (one of st).

§sub: b2

Submachine (one of sub), for the host.

§args: Args

The run’s arguments.

§n: b5

Replicas in this run.

§id: b5

This replica.

§f: b5

Faults tolerated, (n − 1) / 2.

§quorum: b5

Quorum, 2f + 1.

§qbase: b24

First queue pair, (n − 1) · id (peer j at rank j or j − 1).

§mb_prepare: b32

Mailbox bases (words).

§mb_will_cert: b32

will_cert.

§mb_will_commit: b32

will_commit.

§mb_commit: b32

commit.

§mb_certify_valid: b32

certify_valid.

§mb_certify: b32

certify.

§mb_vc: b32

vc.

§mb_vc_valid: b32

vc_valid.

§mb_newview: b32

newview.

§mb_newview_valid: b32

newview_valid.

§view: b32

Current view.

§leader: b5

Its leader.

§stop: bool

The run must stop at the end of this cycle (time up, a bound or a fault).

§seq: b32

The slot’s sequence number (k = seq + 1).

§slot: b4

seq mod G.

§m: b32

The slot’s value, once its prepare is seen.

§local_wait: b32

Polls without progress.

§issued: bool

This state’s broadcast was started.

§bc_done: bool

This state’s broadcast is done; its local record is next.

§wissued: bool

This state’s local write was started.

§second: bool

Unused (kept for the register layout).

§prop: [b32; G]

Proposals waiting, one per window slot.

§prop_valid: [bool; G]

Which window slots hold a proposal.

§enq: b4

Window slot the next proposal goes to.

§out_sent: bool

Decision beats sent: output, remoteUpdate.

§rem_sent: bool

remoteUpdate sent.

§slowed: bool

This slot took the slow path.

§share_beat: b5

Signature beats received (share RAM write address).

§checked: [bool; N]

Peers whose share was checked this slot.

§good: b5

Valid shares counted (ours included).

§peer: b5

The peer being verified.

§reading: bool

The share read was started.

§vbeats: b2

Verify beats sent.

§voted_k: b32

What this replica voted for in the slot: k, m, phase (0 none, 1 will_cert, 2 will_commit or commit).

§voted_m: b32

Its m.

§voted_phase: b2

Its phase.

§rec: b5

Record being read.

§rec_k: [b32; N]

The records: reported k.

§rec_m: [b32; N]

Reported m.

§rec_ok: [bool; N]

The record is for this view and slot and reports a vote.

§nv_k: b32

The chosen (k, m) (k = 0: none).

§nv_m: b32

Its m.

§status: Status

Measurements for the host.

§slot_start: b32

Cycle the current slot started.

Implementations§

Source§

impl<const N: usize, const G: usize> ProtocolState<N, G>

Source

pub fn idle() -> Self

Power-on: stopped, nothing known.

Trait Implementations§

Source§

impl<const N: usize, const G: usize> Clone for ProtocolState<N, G>

Source§

fn clone(&self) -> ProtocolState<N, G>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize, const G: usize> Debug for ProtocolState<N, G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize, const G: usize> Digital for ProtocolState<N, G>

Source§

const BITS: usize

Associated constant that gives the total number of bits needed to represent the value.
Source§

fn static_kind() -> Kind

Returns the [Kind] (run time type descriptor) of the value as a static method
Source§

fn bin(self) -> Box<[BitX]>

Returns the binary representation of the value as a vector of [BitX].
Source§

fn dont_care() -> Self

Returns a “don’t care” value for the type.
§

fn bits() -> usize

Returns the number of bits needed to represent the value.
§

fn kind(&self) -> Kind

Returns the [Kind] (run time type descriptor) of the value.
§

fn typed_bits(self) -> TypedBits

Returns the value as a [TypedBits], which includes both the bits and the kind.
§

fn discriminant(self) -> TypedBits

Returns the discriminant of the value as a [TypedBits].
§

fn variant_kind(self) -> Kind

Returns the [Kind] of the variant if the value is an enum with variants.
§

fn binary_string(self) -> String

Returns the binary representation of the value as a string of ‘0’, ‘1’, and ‘X’.
Source§

impl<const N: usize, const G: usize> PartialEq for ProtocolState<N, G>

Source§

fn eq(&self, other: &ProtocolState<N, G>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize, const G: usize> Copy for ProtocolState<N, G>

Source§

impl<const N: usize, const G: usize> StructuralPartialEq for ProtocolState<N, G>

Auto Trait Implementations§

§

impl<const N: usize, const G: usize> Freeze for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> RefUnwindSafe for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> Send for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> Sync for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> Unpin for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> UnsafeUnpin for ProtocolState<N, G>

§

impl<const N: usize, const G: usize> UnwindSafe for ProtocolState<N, G>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<I, P, O> SynchronousProbeExt<I, P, O> for I

§

fn synchronous_sample(self) -> SynchronousSample<I>
where I: Iterator<Item = TracedSample<(ClockReset, P), O>>, P: Digital, O: Digital,

Create a probe that samples values from the supplied stream just before a positive edge of the clock
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> Traceable for T
where T: Digital,

§

fn bits(&self) -> usize

Get the number of bits for the stored value
§

fn kind(&self) -> Kind

Get the [Kind] of the stored value
§

fn bin(&self) -> Box<[BitX]>

Get the binary representation of the stored value as a vector of [BitX]
§

fn typed_bits(&self) -> TypedBits

Get the [TypedBits] representation of the stored value
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,