From 434843d01dc7a06352b94acb2c7d149ca29226fd Mon Sep 17 00:00:00 2001 From: mikelsr Date: Tue, 13 Aug 2024 20:57:48 +0200 Subject: [PATCH] Move ww_net, ww_proc, and ww_rpc to lib --- Cargo.toml | 10 ++++------ {ww_net => lib/net}/Cargo.toml | 2 +- {ww_net => lib/net}/src/lib.rs | 2 +- {ww_net => lib/net}/src/net.rs | 0 {ww_proc => lib/proc}/Cargo.toml | 6 +++--- {ww_proc => lib/proc}/src/lib.rs | 0 {ww_rpc => lib/rpc}/Cargo.toml | 12 ++++++------ {ww_rpc => lib/rpc}/build.rs | 0 {ww_rpc => lib/rpc}/proc.capnp | 0 {ww_rpc => lib/rpc}/src/client.rs | 0 {ww_rpc => lib/rpc}/src/lib.rs | 0 {ww_rpc => lib/rpc}/src/server.rs | 0 src/main.rs | 4 ++-- 13 files changed, 17 insertions(+), 19 deletions(-) rename {ww_net => lib/net}/Cargo.toml (96%) rename {ww_net => lib/net}/src/lib.rs (98%) rename {ww_net => lib/net}/src/net.rs (100%) rename {ww_proc => lib/proc}/Cargo.toml (84%) rename {ww_proc => lib/proc}/src/lib.rs (100%) rename {ww_rpc => lib/rpc}/Cargo.toml (56%) rename {ww_rpc => lib/rpc}/build.rs (100%) rename {ww_rpc => lib/rpc}/proc.capnp (100%) rename {ww_rpc => lib/rpc}/src/client.rs (100%) rename {ww_rpc => lib/rpc}/src/lib.rs (100%) rename {ww_rpc => lib/rpc}/src/server.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index cf43c94..560c537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] -members = ["ww_net", "ww_proc", "ww_rpc"] +members = ["lib/net", "lib/proc"] [dependencies] anyhow = "1" @@ -15,10 +15,8 @@ futures = "0.3.29" ipfs-api-backend-hyper = "0.6" libp2p = { version = "0.53.2", features = ["full"] } rand = "0.8" -tokio = { version = "1.36", features = ["full"] } +tokio = { version = "1.x", features = ["full"] } tracing = "0.1.37" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -wasmer = "4.3.5" -wasmer-wasix = "0.25.0" -ww_net = { path = "ww_net" } -ww_proc = { path = "ww_proc" } +net = { path = "lib/net" } +proc = { path = "lib/proc" } diff --git a/ww_net/Cargo.toml b/lib/net/Cargo.toml similarity index 96% rename from ww_net/Cargo.toml rename to lib/net/Cargo.toml index 3242fad..e4d0b9b 100644 --- a/ww_net/Cargo.toml +++ b/lib/net/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ww_net" +name = "net" version = "0.1.0" edition = "2021" diff --git a/ww_net/src/lib.rs b/lib/net/src/lib.rs similarity index 98% rename from ww_net/src/lib.rs rename to lib/net/src/lib.rs index 7708353..48667e3 100644 --- a/ww_net/src/lib.rs +++ b/lib/net/src/lib.rs @@ -34,7 +34,7 @@ impl DerefMut for DefaultSwarm { } } -impl net::Dialer for DefaultSwarm { +impl netx::Dialer for DefaultSwarm { // Forward the call to the inner Swarm. fn dial(&mut self, opts: swarm::dial_opts::DialOpts) -> Result<(), swarm::DialError> { self.0.dial(opts) diff --git a/ww_net/src/net.rs b/lib/net/src/net.rs similarity index 100% rename from ww_net/src/net.rs rename to lib/net/src/net.rs diff --git a/ww_proc/Cargo.toml b/lib/proc/Cargo.toml similarity index 84% rename from ww_proc/Cargo.toml rename to lib/proc/Cargo.toml index b5b3e01..77b820c 100644 --- a/ww_proc/Cargo.toml +++ b/lib/proc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ww_proc" +name = "proc" version = "0.1.0" edition = "2021" @@ -11,6 +11,6 @@ uuid = { version = "1.10.0", features = [ "fast-rng", # Use a faster (but still sufficiently random) RNG "macro-diagnostics", # Enable better diagnostics for compile-time UUIDs ] } -wasmer = "4.3.5" -wasmer-wasix = "0.25.0" +wasmer = { version = "4.x" } +wasmer-wasix = { version = "0.24" } tracing = "0.1.37" diff --git a/ww_proc/src/lib.rs b/lib/proc/src/lib.rs similarity index 100% rename from ww_proc/src/lib.rs rename to lib/proc/src/lib.rs diff --git a/ww_rpc/Cargo.toml b/lib/rpc/Cargo.toml similarity index 56% rename from ww_rpc/Cargo.toml rename to lib/rpc/Cargo.toml index c6e41c4..ba417a6 100644 --- a/ww_rpc/Cargo.toml +++ b/lib/rpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ww_rpc" +name = "rpc" version = "0.1.0" edition = "2021" @@ -12,11 +12,11 @@ capnpc = "0.19.0" [dependencies] anyhow = "1" -wasmer = "4.2.8" -wasmer-compiler-cranelift = "4.2.8" -wasmer-middlewares = "4.2.8" +wasmer = "4.x" +# wasmer-compiler-cranelift = "4.2.8" +# wasmer-middlewares = "4.2.8" futures = "0.3.0" -tokio = { version = "1.0.0", features = ["net", "rt", "macros"] } -tokio-util = { version = "0.7.4", features = ["compat"] } +# tokio = { version = "1.36", features = ["net", "rt", "macros"] } +# tokio-util = { version = "0.7.4", features = ["compat"] } capnp = "0.19.3" capnp-rpc = "0.19.0" diff --git a/ww_rpc/build.rs b/lib/rpc/build.rs similarity index 100% rename from ww_rpc/build.rs rename to lib/rpc/build.rs diff --git a/ww_rpc/proc.capnp b/lib/rpc/proc.capnp similarity index 100% rename from ww_rpc/proc.capnp rename to lib/rpc/proc.capnp diff --git a/ww_rpc/src/client.rs b/lib/rpc/src/client.rs similarity index 100% rename from ww_rpc/src/client.rs rename to lib/rpc/src/client.rs diff --git a/ww_rpc/src/lib.rs b/lib/rpc/src/lib.rs similarity index 100% rename from ww_rpc/src/lib.rs rename to lib/rpc/src/lib.rs diff --git a/ww_rpc/src/server.rs b/lib/rpc/src/server.rs similarity index 100% rename from ww_rpc/src/server.rs rename to lib/rpc/src/server.rs diff --git a/src/main.rs b/src/main.rs index 5b60ab1..eb500b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,9 +3,9 @@ use std::{error::Error, time::Duration}; use anyhow::Result; use futures::TryStreamExt; use libp2p::{identify, kad, mdns, noise, ping, swarm, tcp, yamux}; +use net::{self, net, DefaultBehaviour, DefaultBehaviourEvent, DefaultSwarm, IpfsC}; +use proc::{self, WasmRuntime}; use tracing_subscriber::EnvFilter; -use ww_net::{self, net, DefaultBehaviour, DefaultBehaviourEvent, DefaultSwarm, IpfsC}; -use ww_proc::{self, WasmRuntime}; pub mod cfg;