chiark / gitweb /
wip client
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 13 Aug 2020 00:02:05 +0000 (01:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 13 Aug 2020 00:02:05 +0000 (01:02 +0100)
src/client.rs [new file with mode: 0644]
src/imports.rs
src/lib.rs
src/spec.rs

diff --git a/src/client.rs b/src/client.rs
new file mode 100644 (file)
index 0000000..a1124a5
--- /dev/null
@@ -0,0 +1,14 @@
+
+use crate::imports::*;
+
+pub struct MgmtConnection {
+  read : io::Lines<BufReader<UnixStream>>,
+  write : BufWriter<UnixStream>,
+}
+
+impl MgmtConnection {
+  fn connect() {
+    todo!();
+//    let mut both = UnixStream:;connect(SOCKET_PATH)?;
+  }
+}
index 5a2047d77d24046f1232e1317e5d9521fcf43f70..bb48b0ec73cfe1c8108e5cf403c310d8b7122f8f 100644 (file)
@@ -72,6 +72,7 @@ pub use crate::commands::*;
 pub use crate::slotmap_slot_idx::*;
 pub use crate::cmdlistener::*;
 pub use crate::spec::*;
+pub use crate::client::*;
 pub use crate::api::{Lens,TransparentLens};
 pub use crate::utils::OrdExt;
 
index 8636c34fa8d2cb1b4f9b4de451f208eebf612416..638c57dd30b0c7e51f8a67e33f4d345afd89f59e 100644 (file)
@@ -19,4 +19,5 @@ pub mod spec;
 pub mod cmdlistener;
 pub mod commands;
 pub mod utils;
+pub mod client;
 #[path="slotmap-slot-idx.rs"] pub mod slotmap_slot_idx;
index 3aaa5165353c83d3d22500a17786be7a2405b1fc..d11b4dc365ff865284b7aa33421a9399291b8d34 100644 (file)
@@ -12,7 +12,7 @@ pub struct TableSpec {
 pub struct PlayerSpec {
   pub nick: String,
   #[serde(flatten)]
-  pub access: Box<dyn PlayerAccessSpec>,
+  pub access: Option<Box<dyn PlayerAccessSpec>>,
 }
 
 #[derive(Debug,Serialize,Deserialize)]
@@ -33,7 +33,17 @@ pub struct PiecesSpec {
 
 #[typetag::serde(tag="access")]
 pub trait PlayerAccessSpec : Debug {
-  #[throws(OE)]
-  /// todo const DELIVER_TOKEN_SERVER : bool; etc.
-  fn deliver_token(&mut self) -> Result<(),OE>;
+  fn deliver_token_client(&self, conn: &mut MgmtConnection, nick: &str)
+                          -> Result<(),anyhow::Error>;
+}
+
+#[derive(Debug,Serialize,Deserialize)]
+struct UrlOnStdout;
+
+#[typetag::serde]
+impl PlayerAccessSpec for UrlOnStdout {
+  fn deliver_token_client(&self, conn: &mut MgmtConnection, nick: &str)
+                          -> Result<(),anyhow::Error> {
+    todo!()
+  }
 }