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§
Sourcetype ProtocolError: ProtocolError<Id>
type ProtocolError: ProtocolError<Id>
An object of this type will be returned when a provable error happens during Round::receive_message
.
Required Methods§
Sourcefn verify_direct_message_is_invalid(
format: &BoxedFormat,
round_id: &RoundId,
message: &DirectMessage,
) -> Result<(), MessageValidationError>
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.
Sourcefn verify_echo_broadcast_is_invalid(
format: &BoxedFormat,
round_id: &RoundId,
message: &EchoBroadcast,
) -> Result<(), MessageValidationError>
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.
Sourcefn verify_normal_broadcast_is_invalid(
format: &BoxedFormat,
round_id: &RoundId,
message: &NormalBroadcast,
) -> Result<(), MessageValidationError>
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.