Trait streamlette::DeciderConfig
source · pub trait DeciderConfig: Sync + Send + 'static {
// Required methods
fn generate_proposal(&self) -> Bytes;
fn verify_proposal(&self, prop: &[u8]) -> bool;
fn sync_core<'life0, 'life1, 'async_trait>(
&'life0 self,
core: &'life1 mut Core
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn vote_weights(&self) -> BTreeMap<Ed25519PK, u64>;
fn seed(&self) -> u128;
fn my_secret(&self) -> Ed25519SK;
}
Expand description
Required Methods§
sourcefn generate_proposal(&self) -> Bytes
fn generate_proposal(&self) -> Bytes
Generates a new proposal.
sourcefn verify_proposal(&self, prop: &[u8]) -> bool
fn verify_proposal(&self, prop: &[u8]) -> bool
Returns whether a proposed decision is valid.
sourcefn sync_core<'life0, 'life1, 'async_trait>(
&'life0 self,
core: &'life1 mut Core
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sync_core<'life0, 'life1, 'async_trait>( &'life0 self, core: &'life1 mut Core ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Synchronizes, in a best-effort fashion, this “Core” state with other players on the network. Should never return and be cancel-safe; the Decider itself will timeout this as needed.
sourcefn vote_weights(&self) -> BTreeMap<Ed25519PK, u64>
fn vote_weights(&self) -> BTreeMap<Ed25519PK, u64>
Returns a mapping of each player’s public key to how many votes the player has. Must return the same value every time!