referrerpolicy=no-referrer-when-downgrade
malus::interceptor

Trait MessageInterceptor

Source
pub trait MessageInterceptor<Sender>:
    Send
    + Sync
    + Clone
    + 'static
where Sender: SubsystemSender<<Self::Message as AssociateOutgoing>::OutgoingMessages> + Clone + 'static,
{ type Message: AssociateOutgoing + Send + 'static; // Provided methods fn intercept_incoming( &self, _sender: &mut Sender, msg: FromOrchestra<Self::Message>, ) -> Option<FromOrchestra<Self::Message>> { ... } fn need_intercept_outgoing( &self, _msg: &<Self::Message as AssociateOutgoing>::OutgoingMessages, ) -> bool { ... } fn intercept_outgoing( &self, _msg: &<Self::Message as AssociateOutgoing>::OutgoingMessages, ) -> Option<<Self::Message as AssociateOutgoing>::OutgoingMessages> { ... } }
Expand description

Filter incoming and outgoing messages.

Required Associated Types§

Source

type Message: AssociateOutgoing + Send + 'static

The message type the original subsystem handles incoming.

Provided Methods§

Source

fn intercept_incoming( &self, _sender: &mut Sender, msg: FromOrchestra<Self::Message>, ) -> Option<FromOrchestra<Self::Message>>

Filter messages that are to be received by the subsystem.

For non-trivial cases, the sender can be used to send multiple messages after doing some additional processing.

Source

fn need_intercept_outgoing( &self, _msg: &<Self::Message as AssociateOutgoing>::OutgoingMessages, ) -> bool

Specifies if we need to replace some outgoing message with another (potentially empty) message

Source

fn intercept_outgoing( &self, _msg: &<Self::Message as AssociateOutgoing>::OutgoingMessages, ) -> Option<<Self::Message as AssociateOutgoing>::OutgoingMessages>

Send modified message instead of the original one

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<Sender> MessageInterceptor<Sender> for ReplaceValidationResult
where Sender: CandidateValidationSenderTrait + Clone + Send + 'static,

Source§

impl<Sender> MessageInterceptor<Sender> for RequestSpammer
where Sender: NetworkBridgeTxSenderTrait + Clone + Send + 'static,

Source§

impl<Sender> MessageInterceptor<Sender> for IgnoreDisabled
where Sender: RuntimeApiSenderTrait + Clone + Send + 'static,

Source§

impl<Sender, Spawner> MessageInterceptor<Sender> for AncestorDisputer<Spawner>
where Sender: ApprovalVotingSenderTrait + Clone + Send + 'static, Spawner: Spawner + Clone + 'static,

Source§

impl<Sender, Spawner> MessageInterceptor<Sender> for NoteCandidate<Spawner>
where Sender: CandidateBackingSenderTrait + Clone + Send + 'static, Spawner: Spawner + Clone + 'static,