hotstuff_rs::replica

Struct ReplicaSpec

source
pub struct ReplicaSpec<K: KVStore, A: App<K> + 'static, N: Network + 'static> {
Show 31 fields app: A, network: N, kv_store: K, configuration: Configuration, on_insert_block: Option<Box<dyn Fn(&InsertBlockEvent) + Send>>, on_commit_block: Option<Box<dyn Fn(&CommitBlockEvent) + Send>>, on_prune_block: Option<Box<dyn Fn(&PruneBlockEvent) + Send>>, on_update_highest_pc: Option<Box<dyn Fn(&UpdateHighestPCEvent) + Send>>, on_update_locked_pc: Option<Box<dyn Fn(&UpdateLockedPCEvent) + Send>>, on_update_highest_tc: Option<Box<dyn Fn(&UpdateHighestTCEvent) + Send>>, on_update_validator_set: Option<Box<dyn Fn(&UpdateValidatorSetEvent) + Send>>, on_propose: Option<Box<dyn Fn(&ProposeEvent) + Send>>, on_nudge: Option<Box<dyn Fn(&NudgeEvent) + Send>>, on_phase_vote: Option<Box<dyn Fn(&PhaseVoteEvent) + Send>>, on_new_view: Option<Box<dyn Fn(&NewViewEvent) + Send>>, on_timeout_vote: Option<Box<dyn Fn(&TimeoutVoteEvent) + Send>>, on_advance_view: Option<Box<dyn Fn(&AdvanceViewEvent) + Send>>, on_receive_proposal: Option<Box<dyn Fn(&ReceiveProposalEvent) + Send>>, on_receive_nudge: Option<Box<dyn Fn(&ReceiveNudgeEvent) + Send>>, on_receive_phase_vote: Option<Box<dyn Fn(&ReceivePhaseVoteEvent) + Send>>, on_receive_new_view: Option<Box<dyn Fn(&ReceiveNewViewEvent) + Send>>, on_receive_timeout_vote: Option<Box<dyn Fn(&ReceiveTimeoutVoteEvent) + Send>>, on_receive_advance_view: Option<Box<dyn Fn(&ReceiveAdvanceViewEvent) + Send>>, on_start_view: Option<Box<dyn Fn(&StartViewEvent) + Send>>, on_view_timeout: Option<Box<dyn Fn(&ViewTimeoutEvent) + Send>>, on_collect_pc: Option<Box<dyn Fn(&CollectPCEvent) + Send>>, on_collect_tc: Option<Box<dyn Fn(&CollectTCEvent) + Send>>, on_start_sync: Option<Box<dyn Fn(&StartSyncEvent) + Send>>, on_end_sync: Option<Box<dyn Fn(&EndSyncEvent) + Send>>, on_receive_sync_request: Option<Box<dyn Fn(&ReceiveSyncRequestEvent) + Send>>, on_send_sync_response: Option<Box<dyn Fn(&SendSyncResponseEvent) + Send>>,
}
Expand description

Stores all necessary parameters and trait implementations required to run the Replica.

Fields§

§app: A§network: N§kv_store: K§configuration: Configuration§on_insert_block: Option<Box<dyn Fn(&InsertBlockEvent) + Send>>§on_commit_block: Option<Box<dyn Fn(&CommitBlockEvent) + Send>>§on_prune_block: Option<Box<dyn Fn(&PruneBlockEvent) + Send>>§on_update_highest_pc: Option<Box<dyn Fn(&UpdateHighestPCEvent) + Send>>§on_update_locked_pc: Option<Box<dyn Fn(&UpdateLockedPCEvent) + Send>>§on_update_highest_tc: Option<Box<dyn Fn(&UpdateHighestTCEvent) + Send>>§on_update_validator_set: Option<Box<dyn Fn(&UpdateValidatorSetEvent) + Send>>§on_propose: Option<Box<dyn Fn(&ProposeEvent) + Send>>§on_nudge: Option<Box<dyn Fn(&NudgeEvent) + Send>>§on_phase_vote: Option<Box<dyn Fn(&PhaseVoteEvent) + Send>>§on_new_view: Option<Box<dyn Fn(&NewViewEvent) + Send>>§on_timeout_vote: Option<Box<dyn Fn(&TimeoutVoteEvent) + Send>>§on_advance_view: Option<Box<dyn Fn(&AdvanceViewEvent) + Send>>§on_receive_proposal: Option<Box<dyn Fn(&ReceiveProposalEvent) + Send>>§on_receive_nudge: Option<Box<dyn Fn(&ReceiveNudgeEvent) + Send>>§on_receive_phase_vote: Option<Box<dyn Fn(&ReceivePhaseVoteEvent) + Send>>§on_receive_new_view: Option<Box<dyn Fn(&ReceiveNewViewEvent) + Send>>§on_receive_timeout_vote: Option<Box<dyn Fn(&ReceiveTimeoutVoteEvent) + Send>>§on_receive_advance_view: Option<Box<dyn Fn(&ReceiveAdvanceViewEvent) + Send>>§on_start_view: Option<Box<dyn Fn(&StartViewEvent) + Send>>§on_view_timeout: Option<Box<dyn Fn(&ViewTimeoutEvent) + Send>>§on_collect_pc: Option<Box<dyn Fn(&CollectPCEvent) + Send>>§on_collect_tc: Option<Box<dyn Fn(&CollectTCEvent) + Send>>§on_start_sync: Option<Box<dyn Fn(&StartSyncEvent) + Send>>§on_end_sync: Option<Box<dyn Fn(&EndSyncEvent) + Send>>§on_receive_sync_request: Option<Box<dyn Fn(&ReceiveSyncRequestEvent) + Send>>§on_send_sync_response: Option<Box<dyn Fn(&SendSyncResponseEvent) + Send>>

Implementations§

source§

impl<K: KVStore, A: App<K> + 'static, N: Network + 'static> ReplicaSpec<K, A, N>

source

pub fn builder() -> ReplicaSpecBuilder<K, A, N, ((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building a ReplicaSpec. On the builder call the following methods to construct a valid ReplicaSpec.

Required:

  • .app(...)
  • .network(...)
  • .kv_store(...)
  • .configuration(...)

Optional:

  • .on_insert_block(...)
  • .on_commit_block(...)
  • .on_prune_block(...)
  • .on_update_highest_pc(...)
  • .on_update_locked_pc(...)
  • .on_update_locked_tc(...)
  • .on_update_validator_set(...)
  • .on_propose(...)
  • .on_nudge(...)
  • .on_phase_vote(...)
  • .on_new_view(...)
  • .on_timeout_vote(...)
  • .on_advance_view(...)
  • .on_receive_proposal(...)
  • .on_receive_nudge(...)
  • .on_receive_phase_vote(...)
  • .on_receive_new_view(...)
  • .on_receive_timeout_vote(...)
  • .on_receive_advance_view(...)
  • .on_start_view(...)
  • .on_view_timeout(...)
  • .on_collect_pc(...)
  • .on_collect_tc(...)
  • .on_start_sync(...)
  • .on_end_sync(...)
  • .on_receive_sync_request(...)
  • .on_receive_sync_response(...)
source§

impl<K: KVStore, A: App<K> + 'static, N: Network + 'static> ReplicaSpec<K, A, N>

source

pub fn start(self) -> Replica<K>

Starts all threads and channels associated with running a replica, and returns the handles to them in a Replica struct.

Auto Trait Implementations§

§

impl<K, A, N> Freeze for ReplicaSpec<K, A, N>
where A: Freeze, N: Freeze, K: Freeze,

§

impl<K, A, N> !RefUnwindSafe for ReplicaSpec<K, A, N>

§

impl<K, A, N> Send for ReplicaSpec<K, A, N>

§

impl<K, A, N> !Sync for ReplicaSpec<K, A, N>

§

impl<K, A, N> Unpin for ReplicaSpec<K, A, N>
where A: Unpin, N: Unpin, K: Unpin,

§

impl<K, A, N> !UnwindSafe for ReplicaSpec<K, A, N>

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> 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> Same for T

source§

type Output = T

Should always be Self
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