[][src]Struct pbft_engine::message_log::PbftLog

pub struct PbftLog {
    unvalidated_blocks: HashMap<BlockId, Block>,
    blocks: HashSet<Block>,
    messages: HashSet<ParsedMessage>,
    max_log_size: u64,
}

Struct for storing messages that a PbftNode receives

Fields

unvalidated_blocks: HashMap<BlockId, Block>

All blocks received from the validator that have not been validated yet

blocks: HashSet<Block>

All blocks received from the validator that have been validated and not yet garbage collected

messages: HashSet<ParsedMessage>

All messages accepted by the node that have not been garbage collected

max_log_size: u64

Maximum log size

Implementations

impl PbftLog[src]

pub fn new(config: &PbftConfig) -> Self[src]

Create a new, empty PbftLog with the max_log_size specified in the config

pub fn add_validated_block(&mut self, block: Block)[src]

Add an already validated Block to the log

pub fn add_unvalidated_block(&mut self, block: Block)[src]

Add an unvalidated Block to the log

pub fn block_validated(&mut self, block_id: BlockId) -> Option<Block>[src]

Move the Block corresponding to block_id from unvalidated_blocks to blocks. Return the block itself to be used by the calling code.

pub fn block_invalidated(&mut self, block_id: BlockId) -> bool[src]

Drop the Block corresponding to block_id from unvalidated_blocks.

pub fn get_blocks_with_num(&self, block_num: u64) -> Vec<&Block>[src]

Get all Blocks in the message log with the specified block number

pub fn get_block_with_id(&self, block_id: &[u8]) -> Option<&Block>[src]

Get the Block with the specified block ID

pub fn get_unvalidated_block_with_id(&self, block_id: &[u8]) -> Option<&Block>[src]

Get the Block with the specified block ID from unvalidated_blocks.

pub fn add_message(&mut self, msg: ParsedMessage)[src]

Add a parsed PBFT message to the log

pub fn has_pre_prepare(&self, seq_num: u64, view: u64, block_id: &[u8]) -> bool[src]

Check if the log has a PrePrepare at the given view and sequence number that matches the given block ID

pub fn get_messages_of_type_seq(
    &self,
    msg_type: PbftMessageType,
    sequence_number: u64
) -> Vec<&ParsedMessage>
[src]

Obtain all messages from the log that match the given type and sequence_number

pub fn get_messages_of_type_view(
    &self,
    msg_type: PbftMessageType,
    view: u64
) -> Vec<&ParsedMessage>
[src]

Obtain all messages from the log that match the given type and view

pub fn get_messages_of_type_seq_view(
    &self,
    msg_type: PbftMessageType,
    sequence_number: u64,
    view: u64
) -> Vec<&ParsedMessage>
[src]

Obtain all messages from the log that match the given type, sequence number, and view

pub fn get_messages_of_type_seq_view_block(
    &self,
    msg_type: PbftMessageType,
    sequence_number: u64,
    view: u64,
    block_id: &[u8]
) -> Vec<&ParsedMessage>
[src]

Obtain all messages from the log that match the given type, sequence number, view, and block_id

pub fn garbage_collect(&mut self, current_seq_num: u64)[src]

Garbage collect the log if it has reached the max_log_size

Trait Implementations

impl Display for PbftLog[src]

Auto Trait Implementations

impl RefUnwindSafe for PbftLog

impl Send for PbftLog

impl Sync for PbftLog

impl Unpin for PbftLog

impl UnwindSafe for PbftLog

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any