@ -11,6 +11,8 @@ const SUPERVISOR_BACKLOG: usize = 32;
mod dispatch ; pub use dispatch ::* ;
mod dispatch ; pub use dispatch ::* ;
//TODO: This all needs redoing when i'm actually lucid. This part seems okay but the rest of `service` needs to go and be replaced by something like this
/// Signal the shutdown method to the supervisor.
/// Signal the shutdown method to the supervisor.
#[ derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy) ]
#[ derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy) ]
pub enum SupervisorControl
pub enum SupervisorControl
@ -64,13 +66,25 @@ pub(super) struct Supervisor
#[ derive(Debug) ]
#[ derive(Debug) ]
struct SupervisorShared
struct SupervisorShared
{
{
//// scratch that, idk what this was supposed to be for. I'm sure i'll remember if it's important.
/// this is for filtering specific messages to specific subscribers
//sub: RwLock<BTreeMap<ServiceEventKind, ServiceEvent>>,
sub : RwLock < BTreeMap < ServiceEventKind , SESet < ServiceSubID > > > ,
broadcast_root : broadcast ::Sender < ServiceEvent > ,
broadcast_root : broadcast ::Sender < ServiceEvent > ,
state : state ::State ,
state : state ::State ,
}
}
/// A subscriber to supervisor task(s) event pump
#[ derive(Debug) ]
pub struct Subscriber
{
id : ServiceSubID ,
/// For directed messages
spec : mpsc ::Receiver < ServiceEvent > ,
/// For broadcast messages
broad : broadcast ::Receiver < ServiceEvent > ,
}
impl Supervisor
impl Supervisor
{
{