summaryrefslogtreecommitdiffstats
path: root/lib/src/reactor/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/reactor/mod.rs')
-rw-r--r--lib/src/reactor/mod.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/src/reactor/mod.rs b/lib/src/reactor/mod.rs
new file mode 100644
index 0000000..5299851
--- /dev/null
+++ b/lib/src/reactor/mod.rs
@@ -0,0 +1,28 @@
+use std::sync::Arc;
+use std::fmt::Debug;
+
+use anyhow::Result;
+use tokio::sync::RwLock;
+
+use crate::profile::Profile;
+
+mod gossip;
+mod device;
+mod account;
+mod ctrl;
+
+use ctrl::ReactorReceiver;
+
+#[async_trait::async_trait]
+pub trait Reactor {
+ type Request: Debug + Send + Sync;
+ type Reply: Debug + Send + Sync;
+
+ async fn run(self) -> Result<()>;
+}
+
+pub trait ReactorBuilder {
+ type Reactor: Reactor;
+
+ fn build_with_receiver(self, rr: ReactorReceiver<<Self::Reactor as Reactor>::Request, <Self::Reactor as Reactor>::Reply>) -> Self::Reactor;
+}