From e6fe0ec314792d68c2dfd6c5d05dd9b0697f1d1d Mon Sep 17 00:00:00 2001 From: neonphog Date: Fri, 31 May 2024 13:09:52 -0600 Subject: [PATCH 1/4] add a rust trycp client crate --- Cargo.lock | 31 ++++- Cargo.toml | 2 + crates/trycp_api/Cargo.toml | 10 ++ crates/trycp_api/src/lib.rs | 133 ++++++++++++++++++++ crates/trycp_client/Cargo.toml | 13 ++ crates/trycp_client/examples/start_stop.rs | 42 +++++++ crates/trycp_client/src/lib.rs | 138 +++++++++++++++++++++ crates/trycp_server/Cargo.toml | 1 + crates/trycp_server/src/app_interface.rs | 16 ++- crates/trycp_server/src/main.rs | 65 +--------- 10 files changed, 377 insertions(+), 74 deletions(-) create mode 100644 crates/trycp_api/Cargo.toml create mode 100644 crates/trycp_api/src/lib.rs create mode 100644 crates/trycp_client/Cargo.toml create mode 100644 crates/trycp_client/examples/start_stop.rs create mode 100644 crates/trycp_client/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 7e9ecc1c..fa00ebdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2554,15 +2554,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -2572,9 +2573,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2 1.0.84", "quote 1.0.36", @@ -2688,6 +2689,27 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "trycp_api" +version = "0.0.100-alpha0" +dependencies = [ + "serde", + "serde_bytes", + "serde_json", +] + +[[package]] +name = "trycp_client" +version = "0.0.100-alpha0" +dependencies = [ + "futures", + "rmp-serde", + "serde_json", + "tokio", + "tokio-tungstenite", + "trycp_api", +] + [[package]] name = "trycp_server" version = "0.0.100-alpha0" @@ -2705,6 +2727,7 @@ dependencies = [ "structopt", "tokio", "tokio-tungstenite", + "trycp_api", "url", ] diff --git a/Cargo.toml b/Cargo.toml index b98e21a8..19f67fa4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ [workspace] members = [ + "crates/trycp_api", + "crates/trycp_client", "crates/trycp_server", "ts/test/fixture/zomes/coordinator", "ts/test/fixture/zomes/integrity", diff --git a/crates/trycp_api/Cargo.toml b/crates/trycp_api/Cargo.toml new file mode 100644 index 00000000..8c8a1f0d --- /dev/null +++ b/crates/trycp_api/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "trycp_api" +version = "0.0.100-alpha0" +license = "CAL-1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0.192", features = ["derive"] } +serde_bytes = "0.11" +serde_json = "1.0.117" diff --git a/crates/trycp_api/src/lib.rs b/crates/trycp_api/src/lib.rs new file mode 100644 index 00000000..0ac63e3a --- /dev/null +++ b/crates/trycp_api/src/lib.rs @@ -0,0 +1,133 @@ +#![deny(missing_docs)] +//! Protocol for trycp_server websocket messages. + +/// Requests must include a message id. +#[derive(serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "snake_case")] +pub struct RequestWrapper { + /// The message id. + pub id: u64, + + /// The request content. + pub request: Request, +} + +/// Trycp server requests. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "snake_case")] +#[serde(tag = "type")] +pub enum Request { + /// Given a DNA file, stores the DNA and returns the path at which it is stored. + SaveDna { + /// This is actually the dna filename. + id: String, + + /// Content. + #[serde(with = "serde_bytes")] + content: Vec, + }, + + /// Given a DNA URL, ensures that the DNA is downloaded and returns the path at which it is stored. + DownloadDna { + /// Url. + url: String, + }, + + /// Set up a player. + ConfigurePlayer { + /// The player id. + id: String, + + /// The Holochain configuration data that is not provided by trycp. + /// + /// For example: + /// ```yaml + /// signing_service_uri: ~ + /// encryption_service_uri: ~ + /// decryption_service_uri: ~ + /// dpki: ~ + /// network: ~ + /// ``` + partial_config: String, + }, + + /// Start a conductor. + Startup { + /// The conductor id. + id: String, + + /// The log level of the conductor. + log_level: Option, + }, + + /// Shut down a conductor. + Shutdown { + /// The id of the conductor to shut down. + id: String, + + /// The signal with which to shut down the conductor. + signal: Option, + }, + + /// Shuts down all running conductors. + Reset, + + /// Make an admin request. + CallAdminInterface { + /// The conductor id. + id: String, + + /// The request. + #[serde(with = "serde_bytes")] + message: Vec, + }, + + /// Hook up an app interface. + ConnectAppInterface { + /// Token. + token: Vec, + + /// Port. + port: u16, + }, + + /// Disconnect an app interface. + DisconnectAppInterface { + /// Port. + port: u16, + }, + + /// Make an ap request. + CallAppInterface { + /// Port. + port: u16, + + /// The request. + #[serde(with = "serde_bytes")] + message: Vec, + }, +} + +/// A Message from a trycp_server +#[derive(Debug, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "snake_case")] +#[serde(tag = "type")] +pub enum MessageToClient { + /// A signal emitted by a conductor. + Signal { + /// The app port from which this signal was emitted. + port: u16, + + /// The content of the signal. + data: Vec, + }, + + /// A response to a trycp server request. + Response { + /// request message id. + id: u64, + + /// message content. + response: std::result::Result, + }, +} diff --git a/crates/trycp_client/Cargo.toml b/crates/trycp_client/Cargo.toml new file mode 100644 index 00000000..de0fee24 --- /dev/null +++ b/crates/trycp_client/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "trycp_client" +version = "0.0.100-alpha0" +license = "CAL-1.0" +edition = "2021" + +[dependencies] +futures = "0.3.30" +rmp-serde = "1.1" +serde_json = "1.0.117" +tokio = { version = "1.38.0", features = [ "full" ] } +tokio-tungstenite = "0.21" +trycp_api = { version = "0.0.100-alpha0", path = "../trycp_api" } diff --git a/crates/trycp_client/examples/start_stop.rs b/crates/trycp_client/examples/start_stop.rs new file mode 100644 index 00000000..c7ed0cd2 --- /dev/null +++ b/crates/trycp_client/examples/start_stop.rs @@ -0,0 +1,42 @@ +use trycp_client::*; + +const ONE_MIN: std::time::Duration = std::time::Duration::from_secs(60); + +#[tokio::main(flavor = "multi_thread")] +async fn main() { + let (c, _r) = TrycpClient::connect("ws://127.0.0.1:9000").await.unwrap(); + + c.request(Request::Reset, ONE_MIN).await.unwrap(); + + c.request( + Request::ConfigurePlayer { + id: "alice".to_string(), + partial_config: "".to_string(), + }, + ONE_MIN, + ) + .await + .unwrap(); + + c.request( + Request::Startup { + id: "alice".to_string(), + log_level: None, + }, + ONE_MIN, + ) + .await + .unwrap(); + + c.request( + Request::Shutdown { + id: "alice".to_string(), + signal: None, + }, + ONE_MIN, + ) + .await + .unwrap(); + + c.request(Request::Reset, ONE_MIN).await.unwrap(); +} diff --git a/crates/trycp_client/src/lib.rs b/crates/trycp_client/src/lib.rs new file mode 100644 index 00000000..0d533b93 --- /dev/null +++ b/crates/trycp_client/src/lib.rs @@ -0,0 +1,138 @@ +#![deny(missing_docs)] +//! Trycp client. + +use futures::{sink::SinkExt, stream::StreamExt}; +use std::collections::HashMap; +use std::io::Result; +use std::sync::Arc; +use tokio_tungstenite::{ + tungstenite::{client::IntoClientRequest, Message}, + *, +}; +pub use trycp_api::Request; +use trycp_api::*; + +type WsCore = WebSocketStream>; +type WsSink = futures::stream::SplitSink; +type Ws = Arc>; + +/// Signal emitted from a conductor. +pub struct Signal { + /// The app port from which this signal was emitted. + pub port: u16, + + /// The content of the signal. + pub data: Vec, +} + +/// Trycp client recv. +pub struct SignalRecv(tokio::sync::mpsc::Receiver); + +impl SignalRecv { + /// Receive. + pub async fn recv(&mut self) -> Option { + self.0.recv().await + } +} + +/// Trycp client. +pub struct TrycpClient { + ws: Ws, + pend: Arc< + std::sync::Mutex>>>, + >, + recv_task: tokio::task::JoinHandle<()>, +} + +impl Drop for TrycpClient { + fn drop(&mut self) { + let ws = self.ws.clone(); + tokio::task::spawn(async move { + let _ = ws.lock().await.close().await; + }); + self.recv_task.abort(); + } +} + +impl TrycpClient { + /// Connect to a remote trycp server. + pub async fn connect(request: R) -> Result<(Self, SignalRecv)> + where + R: IntoClientRequest + Unpin, + { + let (w, _) = tokio_tungstenite::connect_async(request) + .await + .map_err(std::io::Error::other)?; + + let (sink, mut stream) = w.split(); + + let map: HashMap>> = + HashMap::new(); + let pend = Arc::new(std::sync::Mutex::new(map)); + + let (recv_send, recv_recv) = tokio::sync::mpsc::channel(32); + + let pend2 = pend.clone(); + let recv_task = tokio::task::spawn(async move { + while let Some(Ok(msg)) = stream.next().await { + let msg = msg.into_data(); + let msg: MessageToClient = rmp_serde::from_slice(&msg).unwrap(); + + match msg { + MessageToClient::Signal { port, data } => { + recv_send.send(Signal { port, data }).await.unwrap(); + } + MessageToClient::Response { id, response } => { + if let Some(resp) = pend2.lock().unwrap().remove(&id) { + let _ = resp.send(response.map_err(std::io::Error::other)); + } + } + } + } + }); + + let ws = Arc::new(tokio::sync::Mutex::new(sink)); + + Ok(( + Self { + ws, + pend, + recv_task, + }, + SignalRecv(recv_recv), + )) + } + + /// Make a request of the trycp server. + pub async fn request( + &self, + request: Request, + timeout: std::time::Duration, + ) -> Result { + static RID: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); + let mid = RID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + + let (s, r) = tokio::sync::oneshot::channel(); + + self.pend.lock().unwrap().insert(mid, s); + + let pend = self.pend.clone(); + tokio::task::spawn(async move { + tokio::time::sleep(timeout).await; + pend.lock().unwrap().remove(&mid); + }); + + let request = RequestWrapper { id: mid, request }; + + let request = rmp_serde::to_vec_named(&request).map_err(std::io::Error::other)?; + + self.ws + .lock() + .await + .send(Message::Binary(request)) + .await + .map_err(std::io::Error::other)?; + + r.await.map_err(|_| std::io::Error::other("Closed"))? + } +} diff --git a/crates/trycp_server/Cargo.toml b/crates/trycp_server/Cargo.toml index 588c9e38..326300e4 100644 --- a/crates/trycp_server/Cargo.toml +++ b/crates/trycp_server/Cargo.toml @@ -33,4 +33,5 @@ tokio = { version = "1.24", features = [ "fs", ] } tokio-tungstenite = "0.21" +trycp_api = { version = "0.0.100-alpha0", path = "../trycp_api" } url = "2" diff --git a/crates/trycp_server/src/app_interface.rs b/crates/trycp_server/src/app_interface.rs index 00e09034..79079f09 100644 --- a/crates/trycp_server/src/app_interface.rs +++ b/crates/trycp_server/src/app_interface.rs @@ -26,14 +26,13 @@ pub(crate) static CONNECTIONS: Lazy< type PendingRequests = Arc>>; - #[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case", tag = "type")] enum WireMessage { Authenticate { #[serde(with = "serde_bytes")] - data: Vec - } + data: Vec, + }, } #[derive(serde::Serialize, serde::Deserialize)] @@ -106,9 +105,14 @@ pub(crate) async fn connect( let listen_task = tokio::task::spawn(abortable_listen_future); // As soon as we've started listening, authenticate the connection - let auth_payload = rmp_serde::to_vec_named(&AppAuthenticationRequest { token }).context(SerializeAuth)?; - let auth_msg = rmp_serde::to_vec_named(&WireMessage::Authenticate { data: auth_payload }).context(SerializeAuth)?; - request_writer.send(Message::Binary(auth_msg)).await.context(WsConnect)?; + let auth_payload = + rmp_serde::to_vec_named(&AppAuthenticationRequest { token }).context(SerializeAuth)?; + let auth_msg = rmp_serde::to_vec_named(&WireMessage::Authenticate { data: auth_payload }) + .context(SerializeAuth)?; + request_writer + .send(Message::Binary(auth_msg)) + .await + .context(WsConnect)?; *connection = Some(Connection { listen_task, diff --git a/crates/trycp_server/src/main.rs b/crates/trycp_server/src/main.rs index 6ae44dfb..1c1f5a62 100644 --- a/crates/trycp_server/src/main.rs +++ b/crates/trycp_server/src/main.rs @@ -36,6 +36,7 @@ use tokio_tungstenite::{ tungstenite::{self, Message}, WebSocketStream, }; +use trycp_api::*; // NOTE: don't change without also changing in crates/holochain/src/main.rs const CONDUCTOR_MAGIC_STRING: &str = "Conductor ready."; @@ -107,70 +108,6 @@ struct PlayerProcesses { holochain: Child, } -#[derive(Deserialize)] -#[serde(rename_all = "snake_case")] -struct RequestWrapper { - id: u64, - request: Request, -} - -#[derive(Debug, Deserialize)] -#[serde(rename_all = "snake_case")] -#[serde(tag = "type")] -enum Request { - // Given a DNA file, stores the DNA and returns the path at which it is stored. - SaveDna { - id: String, - #[serde(with = "serde_bytes")] - content: Vec, - }, - // Given a DNA URL, ensures that the DNA is downloaded and returns the path at which it is stored. - DownloadDna { - url: String, - }, - ConfigurePlayer { - id: String, - /// The Holochain configuration data that is not provided by trycp. - /// - /// For example: - /// ```yaml - /// signing_service_uri: ~ - /// encryption_service_uri: ~ - /// decryption_service_uri: ~ - /// dpki: ~ - /// network: ~ - /// ``` - partial_config: String, - }, - Startup { - id: String, - log_level: Option, - }, - Shutdown { - id: String, - signal: Option, - }, - // Shuts down all running conductors. - Reset, - CallAdminInterface { - id: String, - #[serde(with = "serde_bytes")] - message: Vec, - }, - ConnectAppInterface { - token: Vec, - port: u16, - }, - DisconnectAppInterface { - port: u16, - }, - CallAppInterface { - port: u16, - #[serde(with = "serde_bytes")] - message: Vec, - }, -} - fn serialize_resp(id: u64, data: R) -> Vec { rmp_serde::to_vec_named(&MessageToClient::Response { response: data, id }).unwrap() } From 3cfba8fae13c05c9d9bfbb67d6e73f4f28229f56 Mon Sep 17 00:00:00 2001 From: neonphog Date: Fri, 31 May 2024 16:09:50 -0600 Subject: [PATCH 2/4] stronger types response enum --- crates/trycp_api/src/lib.rs | 26 ++++++++++++++++++++++++-- crates/trycp_client/src/lib.rs | 6 +++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/crates/trycp_api/src/lib.rs b/crates/trycp_api/src/lib.rs index 0ac63e3a..14f8f2b9 100644 --- a/crates/trycp_api/src/lib.rs +++ b/crates/trycp_api/src/lib.rs @@ -108,7 +108,29 @@ pub enum Request { }, } -/// A Message from a trycp_server +/// Message response types. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "snake_case")] +#[serde(untagged)] +pub enum MessageResponse { + /// Unit response. + Null, + + /// Encoded response. + Bytes(Vec) +} + +impl MessageResponse { + /// Convert into bytes. + pub fn into_bytes(self) -> Vec { + match self { + Self::Null => Vec::new(), + Self::Bytes(v) => v, + } + } +} + +/// A Message from a trycp_server. #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] #[serde(tag = "type")] @@ -128,6 +150,6 @@ pub enum MessageToClient { id: u64, /// message content. - response: std::result::Result, + response: std::result::Result, }, } diff --git a/crates/trycp_client/src/lib.rs b/crates/trycp_client/src/lib.rs index 0d533b93..68a6ec86 100644 --- a/crates/trycp_client/src/lib.rs +++ b/crates/trycp_client/src/lib.rs @@ -39,7 +39,7 @@ impl SignalRecv { pub struct TrycpClient { ws: Ws, pend: Arc< - std::sync::Mutex>>>, + std::sync::Mutex>>>, >, recv_task: tokio::task::JoinHandle<()>, } @@ -66,7 +66,7 @@ impl TrycpClient { let (sink, mut stream) = w.split(); - let map: HashMap>> = + let map: HashMap>> = HashMap::new(); let pend = Arc::new(std::sync::Mutex::new(map)); @@ -108,7 +108,7 @@ impl TrycpClient { &self, request: Request, timeout: std::time::Duration, - ) -> Result { + ) -> Result { static RID: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); let mid = RID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); From 2c2f05e5bc1ae444303de6e63e7751e6221e5f85 Mon Sep 17 00:00:00 2001 From: neonphog Date: Mon, 3 Jun 2024 12:44:21 -0600 Subject: [PATCH 3/4] workspace deps and rust crates match js version --- Cargo.lock | 104 ++++++++++++++++----------------- Cargo.toml | 15 +++++ crates/trycp_api/Cargo.toml | 8 +-- crates/trycp_client/Cargo.toml | 14 ++--- crates/trycp_server/Cargo.toml | 32 +++++----- 5 files changed, 94 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa00ebdd..13bc0833 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,7 +202,7 @@ version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -521,7 +521,7 @@ checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "strsim 0.10.0", "syn 1.0.109", @@ -535,7 +535,7 @@ checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -587,7 +587,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -599,7 +599,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "rustc_version", "syn 1.0.109", @@ -648,7 +648,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -669,7 +669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ "darling 0.20.9", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -761,7 +761,7 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -872,9 +872,9 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hdi" -version = "0.4.1-rc.0" +version = "0.4.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d9802bc73fa25ee59642694fb90d8c98ba020c13db6f8d756f5cee709d4c3b5" +checksum = "537e36166cbb67222fd6d843dc188f6fd8df8841687479d59d3bf154c52f5343" dependencies = [ "getrandom", "hdk_derive", @@ -890,9 +890,9 @@ dependencies = [ [[package]] name = "hdk" -version = "0.3.1-rc.0" +version = "0.3.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e060c511e60e21a34329ae58335a381b5468e066fd3bb16f5acf2860615f3f19" +checksum = "ecd19f000b1fc3a010fecd61b8d9361074c0547c57ca68c891e48dc60beb2d17" dependencies = [ "getrandom", "hdi", @@ -910,16 +910,16 @@ dependencies = [ [[package]] name = "hdk_derive" -version = "0.3.1-rc.0" +version = "0.3.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc35b42a7b7c52d2d16d7673cee932645230c6d7eb3f4c4b450bc2abeb311c12" +checksum = "46989b5ccdeaaca2a659aa81e2d4b131f139beb40de4da81a09ee4050b952b9e" dependencies = [ "darling 0.14.4", "heck 0.5.0", "holochain_integrity_types", "paste", "proc-macro-error", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -968,9 +968,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "holo_hash" -version = "0.3.1-rc.0" +version = "0.3.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06fe354e9a24ef08ea2f2a5b8660edb3e95ae1a3db0c1ea938a6f313e559047" +checksum = "ac85fb2c1a69522c3381ad53ba8d2c001a91232a63f91e0f200186bf97c3f874" dependencies = [ "base64", "blake2b_simd", @@ -986,9 +986,9 @@ dependencies = [ [[package]] name = "holochain_integrity_types" -version = "0.3.1-rc.0" +version = "0.3.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c347e849b45ddceca322a9ce0c148a57955a8fd811cbc3b95ac57d325973dc" +checksum = "724b18e6c062a0e387333ee2d75206358f6f2ebd674533c2ae93e37a0871a05c" dependencies = [ "holo_hash", "holochain_secure_primitive", @@ -1064,9 +1064,9 @@ dependencies = [ [[package]] name = "holochain_wasmer_common" -version = "0.0.93" +version = "0.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e77c4d54b5bf86dfa0266588d43fc913b0442799f34c8fc04b0e8eda0260bd4" +checksum = "c9f7d17668e4a4997b5e121c7a951ea9606331ef206b991f1e81420c84d98485" dependencies = [ "holochain_serialized_bytes", "serde", @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "holochain_wasmer_guest" -version = "0.0.93" +version = "0.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10fcb10d7d455c5222a13b2343e2a438bcbbf3f97ef79f16c9e01203f6616dd0" +checksum = "e292e12fda0716ce36b566c7cf3dad8443fdc7c56950e42c5a3ba81988e792d0" dependencies = [ "holochain_serialized_bytes", "holochain_wasmer_common", @@ -1092,9 +1092,9 @@ dependencies = [ [[package]] name = "holochain_zome_types" -version = "0.3.1-rc.0" +version = "0.3.1-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2c24fe476406e9c23cefc1bffeae1c4dd2c0fadc73a832a4b26e379be15fc6" +checksum = "aa73998b5509115d9b07940167f96aea2ad724f587603bfa5198f2f4fbe987a4" dependencies = [ "derive_more", "holo_hash", @@ -1623,7 +1623,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -1653,7 +1653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", "version_check", @@ -1665,7 +1665,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "version_check", ] @@ -1681,9 +1681,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.84" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] @@ -1703,7 +1703,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -1723,7 +1723,7 @@ version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", ] [[package]] @@ -1935,7 +1935,7 @@ version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -2184,7 +2184,7 @@ version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -2253,7 +2253,7 @@ checksum = "e63e6744142336dfb606fe2b068afa2e1cca1ee6a5d8377277a92945d81fa331" dependencies = [ "bitflags 1.3.2", "itertools", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -2310,7 +2310,7 @@ version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -2378,7 +2378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "rustversion", "syn 1.0.109", @@ -2417,7 +2417,7 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "unicode-ident", ] @@ -2428,7 +2428,7 @@ version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "unicode-ident", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58071dc2471840e9f374eeb0f6e405a31bccb3cc5d59bb4598f02cafc274b5c4" dependencies = [ "cargo_metadata", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "serde", "strum_macros", @@ -2485,7 +2485,7 @@ dependencies = [ "darling 0.14.4", "if_chain", "lazy_static", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "subprocess", "syn 1.0.109", @@ -2532,7 +2532,7 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -2577,7 +2577,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -2662,7 +2662,7 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", ] @@ -2691,7 +2691,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trycp_api" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" dependencies = [ "serde", "serde_bytes", @@ -2700,10 +2700,10 @@ dependencies = [ [[package]] name = "trycp_client" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" dependencies = [ "futures", - "rmp-serde", + "rmp-serde 0.15.5", "serde_json", "tokio", "tokio-tungstenite", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "trycp_server" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" dependencies = [ "futures", "nix", @@ -2813,7 +2813,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e7e85a0596447f0f2ac090e16bc4c516c6fe91771fb0c0ccf7fa3dae896b9c" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] @@ -2903,7 +2903,7 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", "wasm-bindgen-shared", @@ -2937,7 +2937,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 2.0.66", "wasm-bindgen-backend", @@ -3041,7 +3041,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9352877c4f07fc59146d21b56ae6dc469caf342587f49c81b4fbeafead31972" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.84", + "proc-macro2 1.0.85", "quote 1.0.36", "syn 1.0.109", ] diff --git a/Cargo.toml b/Cargo.toml index 19f67fa4..dea7071c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,24 @@ members = [ resolver = "2" [workspace.dependencies] +futures = "0.3" hdi = "0.4.1-rc.0" hdk = "0.3.1-rc.0" +nix = { version = "0.28", features = ["signal"] } +once_cell = "1.5.0" +parking_lot = "0.12" +reqwest = { version = "0.12", default-features = false } +rmp-serde = "=0.15.5" serde = "1.0.181" +serde_bytes = "0.11" +serde_json = "1.0.117" +slab = "0.4" +snafu = "0.6" +structopt = "0.2" +tokio = "1.38" +tokio-tungstenite = "0.21" +trycp_api = { version = "0.16.0-dev.7", path = "crates/trycp_api" } +url = "2" [profile.dev] opt-level = "z" diff --git a/crates/trycp_api/Cargo.toml b/crates/trycp_api/Cargo.toml index 8c8a1f0d..93f7a184 100644 --- a/crates/trycp_api/Cargo.toml +++ b/crates/trycp_api/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "trycp_api" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" license = "CAL-1.0" edition = "2021" [dependencies] -serde = { version = "1.0.192", features = ["derive"] } -serde_bytes = "0.11" -serde_json = "1.0.117" +serde = { workspace = true, features = ["derive"] } +serde_bytes = { workspace = true } +serde_json = { workspace = true } diff --git a/crates/trycp_client/Cargo.toml b/crates/trycp_client/Cargo.toml index de0fee24..e17a0498 100644 --- a/crates/trycp_client/Cargo.toml +++ b/crates/trycp_client/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "trycp_client" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" license = "CAL-1.0" edition = "2021" [dependencies] -futures = "0.3.30" -rmp-serde = "1.1" -serde_json = "1.0.117" -tokio = { version = "1.38.0", features = [ "full" ] } -tokio-tungstenite = "0.21" -trycp_api = { version = "0.0.100-alpha0", path = "../trycp_api" } +futures = { workspace = true } +rmp-serde = { workspace = true } +serde_json = { workspace = true } +tokio = { workspace = true, features = [ "full" ] } +tokio-tungstenite = { workspace = true } +trycp_api = { workspace = true } diff --git a/crates/trycp_server/Cargo.toml b/crates/trycp_server/Cargo.toml index 326300e4..fc873e01 100644 --- a/crates/trycp_server/Cargo.toml +++ b/crates/trycp_server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "trycp_server" -version = "0.0.100-alpha0" +version = "0.16.0-dev.7" description = "conductor provisioner for tryorama" license = "CAL-1.0" keywords = ["holochain", "holo", "p2p", "network", "simulation"] @@ -11,27 +11,27 @@ authors = ["Holochain Core Dev Team "] edition = "2021" [dependencies] -futures = "0.3" -nix = { version = "0.28", features = ["signal"] } -once_cell = "1.5.0" -parking_lot = "0.12" -reqwest = { version = "0.12", default-features = false, features = [ +futures = { workspace = true } +nix = { workspace = true, features = ["signal"] } +once_cell = { workspace = true } +parking_lot = { workspace = true } +reqwest = { workspace = true, default-features = false, features = [ "blocking", "json", "rustls-tls-native-roots", ] } -rmp-serde = "=0.15.5" -serde = { version = "1.0.181", features = ["derive"] } -serde_bytes = "0.11" -slab = "0.4" -snafu = "0.6" -structopt = "0.2" -tokio = { version = "1.24", features = [ +rmp-serde = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_bytes = { workspace = true } +slab = { workspace = true } +snafu = { workspace = true } +structopt = { workspace = true } +tokio = { workspace = true, features = [ "macros", "rt-multi-thread", "process", "fs", ] } -tokio-tungstenite = "0.21" -trycp_api = { version = "0.0.100-alpha0", path = "../trycp_api" } -url = "2" +tokio-tungstenite = { workspace = true } +trycp_api = { workspace = true } +url = { workspace = true } From bf4a3b5a5025b8f6f2fc02cfad18b2bb3ec7897b Mon Sep 17 00:00:00 2001 From: ThetaSinner Date: Mon, 3 Jun 2024 20:09:47 +0100 Subject: [PATCH 4/4] Add descriptions for new crates --- crates/trycp_api/Cargo.toml | 1 + crates/trycp_client/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/trycp_api/Cargo.toml b/crates/trycp_api/Cargo.toml index 93f7a184..75b28e8c 100644 --- a/crates/trycp_api/Cargo.toml +++ b/crates/trycp_api/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "trycp_api" version = "0.16.0-dev.7" +description = "conductor provisioner API for tryorama" license = "CAL-1.0" edition = "2021" diff --git a/crates/trycp_client/Cargo.toml b/crates/trycp_client/Cargo.toml index e17a0498..d75e964d 100644 --- a/crates/trycp_client/Cargo.toml +++ b/crates/trycp_client/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "trycp_client" version = "0.16.0-dev.7" +description = "Client for TryCP" license = "CAL-1.0" edition = "2021"