Split out syndicate-server crate
This commit is contained in:
parent
37fd904210
commit
4f30faa1ba
|
@ -1283,7 +1283,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syndicate-rs"
|
name = "syndicate"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -1294,10 +1294,21 @@ dependencies = [
|
||||||
"openssl",
|
"openssl",
|
||||||
"preserves",
|
"preserves",
|
||||||
"preserves-schema",
|
"preserves-schema",
|
||||||
"serde",
|
|
||||||
"serde_bytes",
|
|
||||||
"sha2",
|
"sha2",
|
||||||
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"tracing",
|
||||||
|
"tracing-futures",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syndicate-server"
|
||||||
|
version = "0.2.0"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
"structopt",
|
"structopt",
|
||||||
|
"syndicate",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"syndicate",
|
"syndicate",
|
||||||
|
"syndicate-server",
|
||||||
]
|
]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
|
|
|
@ -10,14 +10,14 @@ A Rust implementation of:
|
||||||
- the Syndicate network protocol, including
|
- the Syndicate network protocol, including
|
||||||
|
|
||||||
- a high-speed Dataspace indexing structure
|
- a high-speed Dataspace indexing structure
|
||||||
([`src/skeleton.rs`](src/skeleton.rs); see also
|
([`skeleton.rs`](syndicate/src/skeleton.rs); see also
|
||||||
[HOWITWORKS.md](https://git.syndicate-lang.org/syndicate-lang/syndicate-rkt/src/commit/90c4c60699069b496491b81ee63b5a45ffd638cb/syndicate/HOWITWORKS.md)
|
[HOWITWORKS.md](https://git.syndicate-lang.org/syndicate-lang/syndicate-rkt/src/commit/90c4c60699069b496491b81ee63b5a45ffd638cb/syndicate/HOWITWORKS.md)
|
||||||
from `syndicate-rkt`) and
|
from `syndicate-rkt`) and
|
||||||
|
|
||||||
- a standalone Syndicate protocol "broker" service (roughly
|
- a standalone Syndicate protocol "broker" service (roughly
|
||||||
comparable in scope and intent to D-Bus); and
|
comparable in scope and intent to D-Bus); and
|
||||||
|
|
||||||
- a handful of [example programs](examples/).
|
- a handful of [example programs](syndicate-server/examples/).
|
||||||
|
|
||||||
![The Syndicate/rs server running.](syndicate-rs-server.png)
|
![The Syndicate/rs server running.](syndicate-rs-server.png)
|
||||||
*The Syndicate/rs server running.*
|
*The Syndicate/rs server running.*
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
[package]
|
||||||
|
name = "syndicate-server"
|
||||||
|
version = "0.2.0"
|
||||||
|
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
syndicate = { path = "../syndicate", version = "^0.2.0" }
|
||||||
|
|
||||||
|
futures = "0.3.5"
|
||||||
|
|
||||||
|
structopt = "0.3.14"
|
||||||
|
|
||||||
|
tungstenite = "0.13.0"
|
||||||
|
tokio-tungstenite = "0.14.0"
|
||||||
|
|
||||||
|
tokio = { version = "1.10.0", features = ["io-util", "macros", "sync", "net", "rt", "rt-multi-thread", "time"] }
|
||||||
|
tokio-util = "0.6.7"
|
||||||
|
|
||||||
|
tracing = "0.1.14"
|
||||||
|
tracing-subscriber = "0.2.5"
|
||||||
|
tracing-futures = "0.2.4"
|
|
@ -0,0 +1,50 @@
|
||||||
|
all: binary-debug
|
||||||
|
|
||||||
|
# cargo install cargo-watch
|
||||||
|
watch:
|
||||||
|
cargo watch -c -x check -x 'test -- --nocapture'
|
||||||
|
|
||||||
|
run-watch:
|
||||||
|
RUST_BACKTRACE=1 cargo watch -c -x 'build --all-targets' -x 'run'
|
||||||
|
|
||||||
|
inotifytest:
|
||||||
|
inotifytest sh -c 'reset; cargo build && RUST_BACKTRACE=1 cargo test -- --nocapture'
|
||||||
|
|
||||||
|
binary: binary-release
|
||||||
|
|
||||||
|
binary-release:
|
||||||
|
cargo build --release --all-targets
|
||||||
|
|
||||||
|
binary-debug:
|
||||||
|
cargo build --all-targets
|
||||||
|
|
||||||
|
# OK, rather than doing it myself (per
|
||||||
|
# https://eighty-twenty.org/2019/10/15/cross-compiling-rust), it turns
|
||||||
|
# out past a certain level of complexity we need more than just a
|
||||||
|
# linker but also a C compiler, compatible headers, and so forth. This
|
||||||
|
# proved nontrivial. The Rust team maintains a docker-based
|
||||||
|
# cross-compilation environment that's very easy to use, so instead,
|
||||||
|
# I'll just use that!
|
||||||
|
#
|
||||||
|
# cargo install cross
|
||||||
|
#
|
||||||
|
# The `vendored-openssl` thing is necessary because otherwise I'd have
|
||||||
|
# to mess about with getting a musl build of openssl, plus its headers
|
||||||
|
# etc, ready on my system despite being otherwise able to rely on
|
||||||
|
# cross. I think. It's a bit confusing.
|
||||||
|
|
||||||
|
arm-binary: arm-binary-release
|
||||||
|
|
||||||
|
arm-binary-release:
|
||||||
|
cross build --target=armv7-unknown-linux-musleabihf --release --all-targets --features vendored-openssl
|
||||||
|
|
||||||
|
arm-binary-debug:
|
||||||
|
cross build --target=armv7-unknown-linux-musleabihf --all-targets --features vendored-openssl
|
||||||
|
|
||||||
|
aarch64-binary: aarch64-binary-release
|
||||||
|
|
||||||
|
aarch64-binary-release:
|
||||||
|
cross build --target=aarch64-unknown-linux-musl --release --all-targets --features vendored-openssl
|
||||||
|
|
||||||
|
aarch64-binary-debug:
|
||||||
|
cross build --target=aarch64-unknown-linux-musl --all-targets --features vendored-openssl
|
|
@ -32,7 +32,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let presence: AnyValue = Value::simple_record1(
|
let presence: AnyValue = Value::simple_record1(
|
||||||
"Present",
|
"Present",
|
||||||
Value::from(std::process::id()).wrap()).wrap();
|
Value::from(std::process::id()).wrap()).wrap();
|
||||||
let handle = syndicate::next_handle();
|
let handle = syndicate::actor::next_handle();
|
||||||
let assert_e = || {
|
let assert_e = || {
|
||||||
let ds = Arc::clone(&ds);
|
let ds = Arc::clone(&ds);
|
||||||
let presence = presence.clone();
|
let presence = presence.clone();
|
|
@ -1,10 +1,6 @@
|
||||||
use futures::SinkExt;
|
use futures::SinkExt;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
use preserves::value::Map;
|
|
||||||
use preserves::value::NestedValue;
|
|
||||||
use preserves::value::Value;
|
|
||||||
|
|
||||||
use std::future::ready;
|
use std::future::ready;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
|
@ -23,6 +19,10 @@ use syndicate::schemas::internal_protocol::_Any;
|
||||||
use syndicate::schemas::gatekeeper;
|
use syndicate::schemas::gatekeeper;
|
||||||
use syndicate::sturdy;
|
use syndicate::sturdy;
|
||||||
|
|
||||||
|
use syndicate::value::Map;
|
||||||
|
use syndicate::value::NestedValue;
|
||||||
|
use syndicate::value::Value;
|
||||||
|
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
use tokio::net::UnixListener;
|
use tokio::net::UnixListener;
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "syndicate-rs"
|
name = "syndicate"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
@ -7,9 +7,6 @@ edition = "2018"
|
||||||
[features]
|
[features]
|
||||||
vendored-openssl = ["openssl/vendored"]
|
vendored-openssl = ["openssl/vendored"]
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "syndicate"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
preserves-schema = "0.5.0"
|
preserves-schema = "0.5.0"
|
||||||
|
|
||||||
|
@ -17,10 +14,7 @@ preserves-schema = "0.5.0"
|
||||||
preserves = "0.17.1"
|
preserves = "0.17.1"
|
||||||
preserves-schema = "0.5.0"
|
preserves-schema = "0.5.0"
|
||||||
|
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
tokio = { version = "1.10.0", features = ["io-util", "macros", "sync", "net", "rt", "rt-multi-thread", "time"] }
|
||||||
serde_bytes = "0.11"
|
|
||||||
|
|
||||||
tokio = { version = "1.7.1", features = ["macros", "sync", "net", "rt", "rt-multi-thread", "time"] }
|
|
||||||
tokio-util = "0.6.7"
|
tokio-util = "0.6.7"
|
||||||
bytes = "1.0.1"
|
bytes = "1.0.1"
|
||||||
|
|
||||||
|
@ -30,11 +24,6 @@ getrandom = "0.2.3"
|
||||||
hmac = "0.11.0"
|
hmac = "0.11.0"
|
||||||
sha2 = "0.9.5"
|
sha2 = "0.9.5"
|
||||||
|
|
||||||
structopt = "0.3.14"
|
|
||||||
|
|
||||||
tungstenite = "0.13.0"
|
|
||||||
tokio-tungstenite = "0.14.0"
|
|
||||||
|
|
||||||
tracing = "0.1.14"
|
tracing = "0.1.14"
|
||||||
tracing-subscriber = "0.2.5"
|
tracing-subscriber = "0.2.5"
|
||||||
tracing-futures = "0.2.4"
|
tracing-futures = "0.2.4"
|
||||||
|
|
|
@ -1,55 +1,15 @@
|
||||||
|
all: binary-debug
|
||||||
|
|
||||||
# cargo install cargo-watch
|
# cargo install cargo-watch
|
||||||
watch:
|
watch:
|
||||||
cargo watch -c -x check -x 'test -- --nocapture'
|
cargo watch -c -x check -x 'test -- --nocapture'
|
||||||
|
|
||||||
run-watch:
|
|
||||||
RUST_BACKTRACE=1 cargo watch -c -x 'build --all-targets' -x 'run'
|
|
||||||
|
|
||||||
clippy-watch:
|
|
||||||
cargo watch -c -x clippy
|
|
||||||
|
|
||||||
inotifytest:
|
inotifytest:
|
||||||
inotifytest sh -c 'reset; cargo build && RUST_BACKTRACE=1 cargo test -- --nocapture'
|
inotifytest sh -c 'reset; cargo build && RUST_BACKTRACE=1 cargo test -- --nocapture'
|
||||||
|
|
||||||
binary: binary-release
|
|
||||||
|
|
||||||
binary-release:
|
|
||||||
cargo build --release --all-targets
|
|
||||||
|
|
||||||
binary-debug:
|
binary-debug:
|
||||||
cargo build --all-targets
|
cargo build --all-targets
|
||||||
|
|
||||||
# OK, rather than doing it myself (per
|
|
||||||
# https://eighty-twenty.org/2019/10/15/cross-compiling-rust), it turns
|
|
||||||
# out past a certain level of complexity we need more than just a
|
|
||||||
# linker but also a C compiler, compatible headers, and so forth. This
|
|
||||||
# proved nontrivial. The Rust team maintains a docker-based
|
|
||||||
# cross-compilation environment that's very easy to use, so instead,
|
|
||||||
# I'll just use that!
|
|
||||||
#
|
|
||||||
# cargo install cross
|
|
||||||
#
|
|
||||||
# The `vendored-openssl` thing is necessary because otherwise I'd have
|
|
||||||
# to mess about with getting a musl build of openssl, plus its headers
|
|
||||||
# etc, ready on my system despite being otherwise able to rely on
|
|
||||||
# cross. I think. It's a bit confusing.
|
|
||||||
|
|
||||||
arm-binary: arm-binary-release
|
|
||||||
|
|
||||||
arm-binary-release:
|
|
||||||
cross build --target=armv7-unknown-linux-musleabihf --release --all-targets --features vendored-openssl
|
|
||||||
|
|
||||||
arm-binary-debug:
|
|
||||||
cross build --target=armv7-unknown-linux-musleabihf --all-targets --features vendored-openssl
|
|
||||||
|
|
||||||
aarch64-binary: aarch64-binary-release
|
|
||||||
|
|
||||||
aarch64-binary-release:
|
|
||||||
cross build --target=aarch64-unknown-linux-musl --release --all-targets --features vendored-openssl
|
|
||||||
|
|
||||||
aarch64-binary-debug:
|
|
||||||
cross build --target=aarch64-unknown-linux-musl --all-targets --features vendored-openssl
|
|
||||||
|
|
||||||
pull-protocols:
|
pull-protocols:
|
||||||
git subtree pull -P protocols \
|
git subtree pull -P protocols \
|
||||||
-m 'Merge latest changes from the syndicate-protocols repository' \
|
-m 'Merge latest changes from the syndicate-protocols repository' \
|
||||||
|
|
|
@ -163,12 +163,12 @@ where
|
||||||
const BUMP_AMOUNT: u8 = 10;
|
const BUMP_AMOUNT: u8 = 10;
|
||||||
|
|
||||||
static NEXT_ACTOR_ID: AtomicU64 = AtomicU64::new(1);
|
static NEXT_ACTOR_ID: AtomicU64 = AtomicU64::new(1);
|
||||||
fn next_actor_id() -> ActorId {
|
pub fn next_actor_id() -> ActorId {
|
||||||
NEXT_ACTOR_ID.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
NEXT_ACTOR_ID.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NEXT_HANDLE: AtomicU64 = AtomicU64::new(3);
|
static NEXT_HANDLE: AtomicU64 = AtomicU64::new(3);
|
||||||
fn next_handle() -> Handle {
|
pub fn next_handle() -> Handle {
|
||||||
NEXT_HANDLE.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
NEXT_HANDLE.fetch_add(BUMP_AMOUNT.into(), Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue