pub trait Service {
Show 14 methods fn send_to(
        &mut self,
        peer: &PeerId,
        message_type: &str,
        payload: Vec<u8>
    ) -> Result<(), Error>;
fn broadcast(
        &mut self,
        message_type: &str,
        payload: Vec<u8>
    ) -> Result<(), Error>;
fn initialize_block(
        &mut self,
        previous_id: Option<BlockId>
    ) -> Result<(), Error>;
fn summarize_block(&mut self) -> Result<Vec<u8>, Error>;
fn finalize_block(&mut self, data: Vec<u8>) -> Result<BlockId, Error>;
fn cancel_block(&mut self) -> Result<(), Error>;
fn check_blocks(&mut self, priority: Vec<BlockId>) -> Result<(), Error>;
fn commit_block(&mut self, block_id: BlockId) -> Result<(), Error>;
fn ignore_block(&mut self, block_id: BlockId) -> Result<(), Error>;
fn fail_block(&mut self, block_id: BlockId) -> Result<(), Error>;
fn get_blocks(
        &mut self,
        block_ids: Vec<BlockId>
    ) -> Result<HashMap<BlockId, Block>, Error>;
fn get_chain_head(&mut self) -> Result<Block, Error>;
fn get_settings(
        &mut self,
        block_id: BlockId,
        keys: Vec<String>
    ) -> Result<HashMap<String, String>, Error>;
fn get_state(
        &mut self,
        block_id: BlockId,
        addresses: Vec<String>
    ) -> Result<HashMap<String, Vec<u8>>, Error>;
}
Expand description

Provides methods that allow the consensus engine to issue commands and requests.

Required methods

Send a consensus message to a specific, connected peer

Broadcast a message to all connected peers

Initialize a new block built on the block with the given previous id and begin adding batches to it. If no previous id is specified, the current head will be used.

Stop adding batches to the current block and return a summary of its contents.

Insert the given consensus data into the block and sign it. If this call is successful, the consensus engine will receive the block afterwards.

Stop adding batches to the current block and abandon it.

Update the prioritization of blocks to check

Update the block that should be committed

Signal that this block is no longer being committed

Mark this block as invalid from the perspective of consensus

Retrieve consensus-related information about blocks

Get the chain head block.

Read the value of settings as of the given block

Read values in state as of the given block

Implementors