From 5fe9c4795c3968879ad57003b8246b7e860cd5b1 Mon Sep 17 00:00:00 2001 From: Avril Date: Tue, 19 Jan 2021 02:02:50 +0000 Subject: [PATCH] another failure --- Cargo.toml | 2 +- src/state/service/events.rs | 4 ++-- src/state/service/supervisor/mod.rs | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c326a7f..99299eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ pretty_env_logger = "0.4.0" serde = {version = "1.0.118", features=["derive"]} sha2 = "0.9.2" smallvec = {version = "1.6.0", features= ["union", "serde", "write"]} -smolset = "1.1.0" +smolset = "1.1" tokio = {version = "0.2", features=["full"] } uuid = {version = "0.8.1", features=["v4","serde"]} warp = "0.2.5" diff --git a/src/state/service/events.rs b/src/state/service/events.rs index 33a0dff..478ecd4 100644 --- a/src/state/service/events.rs +++ b/src/state/service/events.rs @@ -21,9 +21,9 @@ cfg_if!{ if #[cfg(debug_assertions)] { /// Type used for directed array. /// Currently testing `smolset` over eagerly allocating. - type SESet = smolset::SmolSet<[T; 1]>; + pub(super) type SESet = smolset::SmolSet<[T; 1]>; } else { - type SESet = std::collections::HashSet; + pub(super) type SESet = std::collections::HashSet; } } diff --git a/src/state/service/supervisor/mod.rs b/src/state/service/supervisor/mod.rs index af4a56e..dab6d09 100644 --- a/src/state/service/supervisor/mod.rs +++ b/src/state/service/supervisor/mod.rs @@ -11,6 +11,8 @@ const SUPERVISOR_BACKLOG: usize = 32; 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. #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] pub enum SupervisorControl @@ -64,13 +66,25 @@ pub(super) struct Supervisor #[derive(Debug)] struct SupervisorShared { - //// scratch that, idk what this was supposed to be for. I'm sure i'll remember if it's important. - //sub: RwLock>, + /// this is for filtering specific messages to specific subscribers + sub: RwLock>>, broadcast_root: broadcast::Sender, state: state::State, } +/// A subscriber to supervisor task(s) event pump +#[derive(Debug)] +pub struct Subscriber +{ + id: ServiceSubID, + + /// For directed messages + spec: mpsc::Receiver, + /// For broadcast messages + broad: broadcast::Receiver, +} + impl Supervisor {