pub trait SubsystemContext: Send + 'static {
    type Message: Debug + Send + 'static;
    type Signal: Debug + Send + 'static;
    type OutgoingMessages: Debug + Send + 'static;
    type Sender: Clone + Send + 'static + SubsystemSender<Self::OutgoingMessages>;
    type Error: Error + From<OrchestraError> + Sync + Send + 'static;

    // Required methods
    fn try_recv<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Option<FromOrchestra<Self::Message, Self::Signal>>, ()>> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn recv<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<FromOrchestra<Self::Message, Self::Signal>, Self::Error>> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn spawn(
        &mut self,
        name: &'static str,
        s: Pin<Box<dyn Future<Output = ()> + Send, Global>>
    ) -> Result<(), Self::Error>;
    fn spawn_blocking(
        &mut self,
        name: &'static str,
        s: Pin<Box<dyn Future<Output = ()> + Send, Global>>
    ) -> Result<(), Self::Error>;
    fn sender(&mut self) -> &mut Self::Sender;

    // Provided methods
    fn send_message<'life0, 'async_trait, T>(
        &'life0 mut self,
        msg: T
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait,
             Self::OutgoingMessages: From<T> + Send,
             T: Send + 'async_trait,
             Self: 'async_trait { ... }
    fn send_messages<'life0, 'async_trait, T, I>(
        &'life0 mut self,
        msgs: I
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait,
             Self::OutgoingMessages: From<T> + Send,
             I: IntoIterator<Item = T> + Send + 'async_trait,
             <I as IntoIterator>::IntoIter: Send,
             T: Send + 'async_trait,
             Self: 'async_trait { ... }
    fn send_unbounded_message<X>(&mut self, msg: X)
       where Self::OutgoingMessages: From<X> + Send,
             X: Send { ... }
}
Expand description

A context type that is given to the Subsystem upon spawning. It can be used by Subsystem to communicate with other Subsystems or spawn jobs.

Required Associated Types§

source

type Message: Debug + Send + 'static

The message type of this context. Subsystems launched with this context will expect to receive messages of this type. Commonly uses the wrapping enum commonly called AllMessages.

source

type Signal: Debug + Send + 'static

And the same for signals.

source

type OutgoingMessages: Debug + Send + 'static

The overarching messages enum for this particular subsystem.

source

type Sender: Clone + Send + 'static + SubsystemSender<Self::OutgoingMessages>

The sender type as provided by sender() and underlying.

source

type Error: Error + From<OrchestraError> + Sync + Send + 'static

The error type.

Required Methods§

source

fn try_recv<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Option<FromOrchestra<Self::Message, Self::Signal>>, ()>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Try to asynchronously receive a message.

Has to be used with caution, if you loop over this without using pending!() macro you will end up with a busy loop!

source

fn recv<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<FromOrchestra<Self::Message, Self::Signal>, Self::Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,

Receive a message.

source

fn spawn( &mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send, Global>> ) -> Result<(), Self::Error>

Spawn a child task on the executor.

source

fn spawn_blocking( &mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send, Global>> ) -> Result<(), Self::Error>

Spawn a blocking child task on the executor’s dedicated thread pool.

source

fn sender(&mut self) -> &mut Self::Sender

Obtain the sender.

Provided Methods§

source

fn send_message<'life0, 'async_trait, T>( &'life0 mut self, msg: T ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self::OutgoingMessages: From<T> + Send, T: Send + 'async_trait, Self: 'async_trait,

Send a direct message to some other Subsystem, routed based on message type.

source

fn send_messages<'life0, 'async_trait, T, I>( &'life0 mut self, msgs: I ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self::OutgoingMessages: From<T> + Send, I: IntoIterator<Item = T> + Send + 'async_trait, <I as IntoIterator>::IntoIter: Send, T: Send + 'async_trait, Self: 'async_trait,

Send multiple direct messages to other Subsystems, routed based on message type.

source

fn send_unbounded_message<X>(&mut self, msg: X)where Self::OutgoingMessages: From<X> + Send, X: Send,

Send a message using the unbounded connection.

Implementors§

source§

impl SubsystemContext for OverseerSubsystemContext<ApprovalDistributionMessage>where ApprovalDistributionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<ApprovalDistributionOutgoingMessages> + From<ApprovalDistributionMessage>, ApprovalDistributionOutgoingMessages: From<NetworkBridgeTxMessage> + From<ApprovalVotingMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<ApprovalVotingMessage>where ApprovalVotingMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<ApprovalVotingOutgoingMessages> + From<ApprovalVotingMessage>, ApprovalVotingOutgoingMessages: From<ApprovalDistributionMessage> + From<AvailabilityRecoveryMessage> + From<CandidateValidationMessage> + From<ChainApiMessage> + From<ChainSelectionMessage> + From<DisputeCoordinatorMessage> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<AvailabilityDistributionMessage>where AvailabilityDistributionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<AvailabilityDistributionOutgoingMessages> + From<AvailabilityDistributionMessage>, AvailabilityDistributionOutgoingMessages: From<AvailabilityStoreMessage> + From<AvailabilityRecoveryMessage> + From<ChainApiMessage> + From<RuntimeApiMessage> + From<NetworkBridgeTxMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<AvailabilityRecoveryMessage>where AvailabilityRecoveryMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<AvailabilityRecoveryOutgoingMessages> + From<AvailabilityRecoveryMessage>, AvailabilityRecoveryOutgoingMessages: From<NetworkBridgeTxMessage> + From<RuntimeApiMessage> + From<AvailabilityStoreMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<AvailabilityStoreMessage>where AvailabilityStoreMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<AvailabilityStoreOutgoingMessages> + From<AvailabilityStoreMessage>, AvailabilityStoreOutgoingMessages: From<ChainApiMessage> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<BitfieldDistributionMessage>where BitfieldDistributionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<BitfieldDistributionOutgoingMessages> + From<BitfieldDistributionMessage>, BitfieldDistributionOutgoingMessages: From<RuntimeApiMessage> + From<NetworkBridgeTxMessage> + From<ProvisionerMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<CandidateBackingMessage>where CandidateBackingMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<CandidateBackingOutgoingMessages> + From<CandidateBackingMessage>, CandidateBackingOutgoingMessages: From<CandidateValidationMessage> + From<CollatorProtocolMessage> + From<AvailabilityDistributionMessage> + From<AvailabilityStoreMessage> + From<StatementDistributionMessage> + From<ProvisionerMessage> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<CandidateValidationMessage>where CandidateValidationMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<CandidateValidationOutgoingMessages> + From<CandidateValidationMessage>, CandidateValidationOutgoingMessages: From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<ChainApiMessage>where ChainApiMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<ChainApiOutgoingMessages> + From<ChainApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<ChainSelectionMessage>where ChainSelectionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<ChainSelectionOutgoingMessages> + From<ChainSelectionMessage>, ChainSelectionOutgoingMessages: From<ChainApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<CollationGenerationMessage>where CollationGenerationMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<CollationGenerationOutgoingMessages> + From<CollationGenerationMessage>, CollationGenerationOutgoingMessages: From<RuntimeApiMessage> + From<CollatorProtocolMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<CollatorProtocolMessage>where CollatorProtocolMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<CollatorProtocolOutgoingMessages> + From<CollatorProtocolMessage>, CollatorProtocolOutgoingMessages: From<NetworkBridgeTxMessage> + From<RuntimeApiMessage> + From<CandidateBackingMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<DisputeCoordinatorMessage>where DisputeCoordinatorMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<DisputeCoordinatorOutgoingMessages> + From<DisputeCoordinatorMessage>, DisputeCoordinatorOutgoingMessages: From<RuntimeApiMessage> + From<ChainApiMessage> + From<DisputeDistributionMessage> + From<CandidateValidationMessage> + From<ApprovalVotingMessage> + From<AvailabilityStoreMessage> + From<AvailabilityRecoveryMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<DisputeDistributionMessage>where DisputeDistributionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<DisputeDistributionOutgoingMessages> + From<DisputeDistributionMessage>, DisputeDistributionOutgoingMessages: From<RuntimeApiMessage> + From<DisputeCoordinatorMessage> + From<NetworkBridgeTxMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<GossipSupportMessage>where GossipSupportMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<GossipSupportOutgoingMessages> + From<GossipSupportMessage>, GossipSupportOutgoingMessages: From<NetworkBridgeTxMessage> + From<NetworkBridgeRxMessage> + From<RuntimeApiMessage> + From<ChainSelectionMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<NetworkBridgeRxMessage>where NetworkBridgeRxMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<NetworkBridgeRxOutgoingMessages> + From<NetworkBridgeRxMessage>, NetworkBridgeRxOutgoingMessages: From<BitfieldDistributionMessage> + From<StatementDistributionMessage> + From<ApprovalDistributionMessage> + From<GossipSupportMessage> + From<DisputeDistributionMessage> + From<CollationGenerationMessage> + From<CollatorProtocolMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<NetworkBridgeTxMessage>where NetworkBridgeTxMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<NetworkBridgeTxOutgoingMessages> + From<NetworkBridgeTxMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<ProvisionerMessage>where ProvisionerMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<ProvisionerOutgoingMessages> + From<ProvisionerMessage>, ProvisionerOutgoingMessages: From<RuntimeApiMessage> + From<CandidateBackingMessage> + From<ChainApiMessage> + From<DisputeCoordinatorMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<RuntimeApiMessage>where RuntimeApiMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<RuntimeApiOutgoingMessages> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<StatementDistributionMessage>where StatementDistributionMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<StatementDistributionOutgoingMessages> + From<StatementDistributionMessage>, StatementDistributionOutgoingMessages: From<NetworkBridgeTxMessage> + From<CandidateBackingMessage> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<BitfieldSigningMessage>where BitfieldSigningMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<BitfieldSigningOutgoingMessages> + From<BitfieldSigningMessage>, BitfieldSigningOutgoingMessages: From<AvailabilityStoreMessage> + From<RuntimeApiMessage> + From<BitfieldDistributionMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<PvfCheckerMessage>where PvfCheckerMessage: AssociateOutgoing + Debug + Send + 'static, AllMessages: From<PvfCheckerOutgoingMessages> + From<PvfCheckerMessage>, PvfCheckerOutgoingMessages: From<CandidateValidationMessage> + From<RuntimeApiMessage>,

source§

impl SubsystemContext for OverseerSubsystemContext<()>where (): AssociateOutgoing + Debug + Send + 'static, AllMessages: From<()>,