Trait Protocol

Source
pub trait Protocol<Id>: 'static {
    type Result: Debug;
    type ProtocolError: ProtocolError<Id>;

    // Required methods
    fn verify_direct_message_is_invalid(
        format: &BoxedFormat,
        round_id: &RoundId,
        message: &DirectMessage,
    ) -> Result<(), MessageValidationError>;
    fn verify_echo_broadcast_is_invalid(
        format: &BoxedFormat,
        round_id: &RoundId,
        message: &EchoBroadcast,
    ) -> Result<(), MessageValidationError>;
    fn verify_normal_broadcast_is_invalid(
        format: &BoxedFormat,
        round_id: &RoundId,
        message: &NormalBroadcast,
    ) -> Result<(), MessageValidationError>;
}
Expand description

A distributed protocol.

Required Associated Types§

Source

type Result: Debug

The successful result of an execution of this protocol.

Source

type ProtocolError: ProtocolError<Id>

An object of this type will be returned when a provable error happens during Round::receive_message.

Required Methods§

Source

fn verify_direct_message_is_invalid( format: &BoxedFormat, round_id: &RoundId, message: &DirectMessage, ) -> Result<(), MessageValidationError>

Returns Ok(()) if the given direct message cannot be deserialized assuming it is a direct message from the round round_id.

Normally one would use ProtocolMessagePart::verify_is_not and ProtocolMessagePart::verify_is_some when implementing this.

Source

fn verify_echo_broadcast_is_invalid( format: &BoxedFormat, round_id: &RoundId, message: &EchoBroadcast, ) -> Result<(), MessageValidationError>

Returns Ok(()) if the given echo broadcast cannot be deserialized assuming it is an echo broadcast from the round round_id.

Normally one would use ProtocolMessagePart::verify_is_not and ProtocolMessagePart::verify_is_some when implementing this.

Source

fn verify_normal_broadcast_is_invalid( format: &BoxedFormat, round_id: &RoundId, message: &NormalBroadcast, ) -> Result<(), MessageValidationError>

Returns Ok(()) if the given echo broadcast cannot be deserialized assuming it is an echo broadcast from the round round_id.

Normally one would use ProtocolMessagePart::verify_is_not and ProtocolMessagePart::verify_is_some when implementing this.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Id, C> Protocol<Id> for C
where Id: 'static, C: ChainedProtocol<Id> + ChainedMarker,