diff --git a/examples/README.md b/examples/README.md index b1db472b..f7993f0f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,4 +1,4 @@ -# Elfo Examples +# elfo examples This directory contains a collection of examples that demonstrate the use of the `elfo` ecosystem. @@ -8,6 +8,16 @@ Run `cargo run --example ` to run specific example if not specified someth Describes common concepts of `elfo`, also how to work with configuration, combine actors together, enable metrics, logs and dumps. +## network + +Shows how to connect distributed actor groups. + +For simplicity, it uses one common binary that runs a specific service based on the CLI argument: +```sh +cargo run --example network -- alice & +cargo run --example network -- bob +``` + ## stream Demonstrates how to attach streams to an actor's context. diff --git a/examples/examples/network/alice.rs b/examples/examples/network/alice.rs index 8df7d50f..0777bda2 100644 --- a/examples/examples/network/alice.rs +++ b/examples/examples/network/alice.rs @@ -3,7 +3,7 @@ use std::time::Duration; use elfo::{prelude::*, time::Interval, topology::Outcome}; use tracing::{info, warn}; -use crate::common::{AskName, Hello}; +use crate::protocol::{AskName, Hello}; fn producer() -> Blueprint { #[message] diff --git a/examples/examples/network/bob.rs b/examples/examples/network/bob.rs index 41de5e20..3b0f8d67 100644 --- a/examples/examples/network/bob.rs +++ b/examples/examples/network/bob.rs @@ -1,7 +1,7 @@ use elfo::prelude::*; use tracing::{info, warn}; -use crate::common::{AskName, Hello}; +use crate::protocol::{AskName, Hello}; fn consumer() -> Blueprint { ActorGroup::new().exec(|mut ctx| async move { diff --git a/examples/examples/network/main.rs b/examples/examples/network/main.rs index 20a59521..8551bdd0 100644 --- a/examples/examples/network/main.rs +++ b/examples/examples/network/main.rs @@ -1,6 +1,6 @@ mod alice; mod bob; -mod common; +mod protocol; #[tokio::main] async fn main() { diff --git a/examples/examples/network/common.rs b/examples/examples/network/protocol.rs similarity index 100% rename from examples/examples/network/common.rs rename to examples/examples/network/protocol.rs diff --git a/examples/examples/usage/main.rs b/examples/examples/usage/main.rs index 7a5a86b8..4d4869bc 100644 --- a/examples/examples/usage/main.rs +++ b/examples/examples/usage/main.rs @@ -103,7 +103,7 @@ mod producer { // aggregator //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// A more actor group that has sharding. +// Another actor group with sharding. mod aggregator { use elfo::{ prelude::*,