Trait splinter::consensus::ProposalManager[][src]

pub trait ProposalManager: Send {
    fn create_proposal(
        &self,
        previous_proposal_id: Option<ProposalId>,
        consensus_data: Vec<u8>
    ) -> Result<(), ProposalManagerError>;
fn check_proposal(
        &self,
        id: &ProposalId
    ) -> Result<(), ProposalManagerError>;
fn accept_proposal(
        &self,
        id: &ProposalId,
        consensus_data: Option<Vec<u8>>
    ) -> Result<(), ProposalManagerError>;
fn reject_proposal(
        &self,
        id: &ProposalId
    ) -> Result<(), ProposalManagerError>; fn should_build_proposals(
        &self,
        _should_build: bool
    ) -> Result<(), ProposalManagerError> { ... } }

Interface used by consensus to create, check, accept, and reject proposals

Required methods

fn create_proposal(
    &self,
    previous_proposal_id: Option<ProposalId>,
    consensus_data: Vec<u8>
) -> Result<(), ProposalManagerError>
[src]

Generate a new Proposal with the given consensus bytes that’s based on the previous proposal if Some, otherwise the manager will use the last applied proposal.

fn check_proposal(&self, id: &ProposalId) -> Result<(), ProposalManagerError>[src]

Verify that the data corresponding to specified proposal ID is valid from the perspective of the proposal manager (only necessary for Proposals received from peers).

fn accept_proposal(
    &self,
    id: &ProposalId,
    consensus_data: Option<Vec<u8>>
) -> Result<(), ProposalManagerError>
[src]

Consensus has approved the given proposal. New consensus data may be provided to replace the existing data.

fn reject_proposal(&self, id: &ProposalId) -> Result<(), ProposalManagerError>[src]

Consensus has rejected the given proposal.

Loading content...

Provided methods

fn should_build_proposals(
    &self,
    _should_build: bool
) -> Result<(), ProposalManagerError>
[src]

Informs the manager if consensus will ask for proposals; if not, the manager does not need to build them.

Some managers may take arbitrarily long to assemble/process proposals, and some consensus algorithms designate nodes that do not create proposals at all. This allows for optimizing performance in some cases.

The default implementation does nothing, since this is only useful for some managers.

Loading content...

Implementors

Loading content...