Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Overseer: allow subsystems to instruct the overseer to send signals #4961

Closed
rphmeier opened this issue Feb 21, 2022 · 8 comments
Closed

Overseer: allow subsystems to instruct the overseer to send signals #4961

rphmeier opened this issue Feb 21, 2022 · 8 comments
Assignees
Labels
I8-refactor Code needs refactoring.

Comments

@rphmeier
Copy link
Contributor

We should create a new message from subsystems to the overseer which informs the overseer to send a specific signal. We might introduce a generic type parameter SubsystemInitiatedSignal which would allow us to prevent subsystems from sending signals such as Conclude, ActiveLeavesUpdate, or other stuff that they shouldn't.

cc @drahnr as the overseer expert

@rphmeier rphmeier added the I8-refactor Code needs refactoring. label Feb 21, 2022
@rphmeier rphmeier changed the title Overseer: allow subsystems to send initiate signals Overseer: allow subsystems to ask the overseer to send signals Feb 21, 2022
@rphmeier rphmeier changed the title Overseer: allow subsystems to ask the overseer to send signals Overseer: allow subsystems to instruct the overseer to send signals Feb 21, 2022
@rphmeier
Copy link
Contributor Author

My gut instinct says that this can be done against master and not against the asynchronous backing feature branch, even though this is pre-requisite to async backing. SubsystemInitiatedSignal could be enum Void {} in master.

@drahnr drahnr self-assigned this Feb 22, 2022
@drahnr
Copy link
Contributor

drahnr commented Feb 23, 2022

I think this has two components:

  1. receive a message
  2. send the message

If there is no logic attached to it, or that logic resides within a small set of subsystems, directly calling fn broadcast_signal might be an option as well.

pub async fn broadcast_signal(&mut self, signal: #signal_ty) -> ::std::result::Result<(), #error_ty > {

Now one would need access to funnel the infor into Overseer::run, which can either be done as a separate stream or integrated with the existing Events, exposed with the SubsystemContext or trait SubsystemSender.

There are a few open questions to be clarified before starting the implementation:

  1. do we require mpsc::Senders in those messages that we broadcast? Chances for cyclic dependencies that would not be detected by the planned cycle detection based on incoming/outgoing message types/variants.
  2. what's the frequency of these?
  3. what nature would those signals be, more events or more messages?
  4. what's the synchronicity requirement regarding active leaves between different subsystems?

Effort seems to be reasonably bounded

@rphmeier
Copy link
Contributor Author

rphmeier commented Feb 23, 2022

  1. do we require mpsc::Senders in those messages that we broadcast? Chances for cyclic dependencies that would not be detected by the planned cycle detection based on incoming/outgoing message types/variants.

No, I think they'd be pure data for any reasonable use-case. But I guess anything Clone can suffice.

  1. what's the frequency of these?

Very frequent

  1. what nature would those signals be, more events or more messages?

I don't understand the distinction really. specifically, stuff like the ViableCandidateBase from #4962 is the intended use-case.

  1. what's the synchronicity requirement regarding active leaves between different subsystems?

The only requirement on signals and messaging is that a message sent after receipt of a signal on one subsystem may only be observed by another subsystem after the receipt of the same signal. This property should be the same.

@drahnr
Copy link
Contributor

drahnr commented Feb 23, 2022

No 3 was a fuzzy one, thanks for clarifying the rest!

@rphmeier
Copy link
Contributor Author

Right now we have

enum FromOverseer<M> {
    Signal(OverseerSignal),
    Communication { msg: M },
}

One way to achieve this would be to change the definition to

enum FromOverseer<M, US> {
    Signal(OverseerSignal),
    UserSignal(US),
    Communication { msg: M },
}

and then have trait Subsystem gain an associated type UserSignal (which is usually Void).

and then have the overseer be generic over US where the subsystems are all bounded on where US: From<Subsystem::UserSignal>

@drahnr
Copy link
Contributor

drahnr commented Mar 11, 2022

If we go for the pull based retrieval, we can close this, or are there any remaining usecases?

@rphmeier
Copy link
Contributor Author

There are possibly other use-cases but none in the near term

@drahnr
Copy link
Contributor

drahnr commented Mar 12, 2022

Closing for now

@drahnr drahnr closed this as completed Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I8-refactor Code needs refactoring.
Projects
None yet
Development

No branches or pull requests

2 participants