Skip to content

Commit

Permalink
Release client-0.4.0, protocol-0.3.0, server-0.4.0, standard-0.2.2, t…
Browse files Browse the repository at this point in the history
…ests-0.3.0 (#178)
  • Loading branch information
petehayes102 authored Feb 15, 2024
1 parent 3e08f3d commit 05b03cb
Show file tree
Hide file tree
Showing 42 changed files with 846 additions and 362 deletions.
79 changes: 74 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ $ cargo run

### Running Benchmarks

Included in the repository is a `benchmarks` binary containing end-to-end benchmarks for the publisher/subscriber clients.
Included in the repository is a `benchmarks` binary containing end-to-end benchmarks for the publisher/subscriber clients.

These benchmarks measure the performance of both encoding/decoding message payloads on the client, as well the responsiveness of the
These benchmarks measure the performance of both encoding/decoding message payloads on the client, as well the responsiveness of the
Selium server.

To run the benchmarks with the default options, execute the following commands:
Expand All @@ -115,7 +115,7 @@ $ cd benchmarks
$ cargo run --release
```

This will run the benchmarks with default values provided for the benchmark configuration arguments, which should produce a summary
This will run the benchmarks with default values provided for the benchmark configuration arguments, which should produce a summary
similar to the following:

```bash
Expand All @@ -131,19 +131,20 @@ Message Size (Bytes): 32
| 1.3476 Secs | 30.52 MB | 22.65 MB/s | 1347.56 ns |
```

If the default configuration is not sufficient, execute the following command to see a list of benchmark arguments.
If the default configuration is not sufficient, execute the following command to see a list of benchmark arguments.
```bash
$ cargo run -- --help
```
```

### Next Steps

Selium is a brokered messaging platform, meaning that it has a client and a server component. Check
out the [`client`](client/) and [`server`](server/) crates for more details.

We also have [the wiki](../../wiki) that includes all of this information and much more. Our
[Getting Started](../../wiki/Getting-Started) guide will step you through the process of setting up
a secure, working Selium platform in 5 minutes or less.
We also have [the user guide](https://guide.selium.com) that includes all of this information and
much more. Our [Getting Started](https://guide.selium.com/getting_started/first_steps.html) chapters
will step you through the process of setting up a secure, working Selium platform in 5 minutes or
less.

## Contributing to Selium

Expand Down
5 changes: 5 additions & 0 deletions client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
- Add closure so client can gracefully handle replier errors
- Add CA certificate
- Bug fix for Selium Cloud

## v0.4.0

- Add `tracing` lib to improve visibility
- Improve and customise keepalive semantics for each stream type
6 changes: 4 additions & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "selium"
version = "0.3.1"
version = "0.4.0"
description = """
An extremely developer friendly, composable messaging platform with zero build
time configuration.
Expand All @@ -25,15 +25,17 @@ futures = "0.3"
quinn = "0.10"
rustls = "0.21"
rustls-pemfile = "1.0"
selium-protocol = { version = "0.2", path = "../protocol" }
selium-protocol = { version = "0.3", path = "../protocol" }
selium-std = { version = "0.2", path = "../standard" }
tokio = { version = "1.34", features = ["full"] }
tracing = "0.1"

[dev-dependencies]
anyhow = "1.0"
fake = "2.9"
rand = "0.8"
serde = "1.0"
tracing-subscriber = "0.3"

[features]
chrono = ["dep:chrono"]
Expand Down
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ my_stream.forward(publisher);
Now you're publishing messages!

There's lots more Selium can do, like sending things other than strings. Be sure to
[checkout the wiki](../../../wiki/Getting-Started) for more details.
[checkout the user guide](https://guide.selium.com) for more details.
17 changes: 4 additions & 13 deletions client/examples/reply.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use selium::prelude::*;
use selium::std::codecs::BincodeCodec;
use selium::{keep_alive::BackoffStrategy, prelude::*};
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
Expand All @@ -17,6 +17,7 @@ enum Response {
async fn main() -> Result<()> {
let connection = selium::custom()
.keep_alive(5_000)?
.backoff_strategy(BackoffStrategy::constant().with_max_attempts(1))
.endpoint("127.0.0.1:7001")
.with_certificate_authority("../certs/client/ca.der")?
.with_cert_and_key(
Expand All @@ -26,25 +27,15 @@ async fn main() -> Result<()> {
.connect()
.await?;

let replier = connection
let mut replier = connection
.replier("/some/endpoint")
.with_request_decoder(BincodeCodec::default())
.with_reply_encoder(BincodeCodec::default())
.with_handler(|req| async move { handler(req).await })
.open()
.await?;

// To handle errors gracefully without terminating the listener, create an error
// handler that returns 'true'.
replier
.listen(|e| {
eprintln!("{e:?}");
true
})
.await?;

// To terminate on errors, create an error handler that returns 'false'
// replier.listen(|_| false).await?;
replier.listen().await?;

Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions client/examples/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use selium::std::codecs::StringCodec;

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().init();

let connection = selium::custom()
.keep_alive(5_000)?
.endpoint("127.0.0.1:7001")
Expand Down
6 changes: 6 additions & 0 deletions client/src/client/cloud/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::connection::{ClientConnection, ConnectionOptions};
use crate::constants::SELIUM_CLOUD_REMOTE_URL;
use crate::crypto::cert::load_keypair;
use crate::keep_alive::BackoffStrategy;
use crate::logging;
use crate::traits::TryIntoU64;
use crate::{Client, ClientBuilder, ClientCommon};
use selium_std::errors::{Result, SeliumError};
Expand Down Expand Up @@ -76,9 +77,13 @@ impl ClientBuilder<CloudWantsConnect> {
} = common;

let options = ConnectionOptions::new(certs.as_slice(), key, root_store, keep_alive);
logging::connection::get_cloud_endpoint();
let endpoint = get_cloud_endpoint(options.clone()).await?;

logging::connection::connect_to_address(&endpoint);
let connection = ClientConnection::connect(&endpoint, options).await?;
let connection = Arc::new(Mutex::new(connection));
logging::connection::successful_connection(&endpoint);

Ok(Client {
connection,
Expand All @@ -87,6 +92,7 @@ impl ClientBuilder<CloudWantsConnect> {
}
}

#[tracing::instrument]
async fn get_cloud_endpoint(options: ConnectionOptions) -> Result<String> {
let connection = ClientConnection::connect(SELIUM_CLOUD_REMOTE_URL, options).await?;
let (_, mut read) = connection
Expand Down
11 changes: 9 additions & 2 deletions client/src/client/custom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ mod states;
pub use states::*;

use crate::connection::{ClientConnection, ConnectionOptions};
use crate::constants::SELIUM_CLOUD_REMOTE_URL;
use crate::crypto::cert::{load_certs, load_keypair, load_root_store};
use crate::keep_alive::BackoffStrategy;
use crate::logging;
use crate::traits::TryIntoU64;
use crate::{Client, ClientBuilder, ClientCommon};
use selium_std::errors::Result;
use selium_std::errors::{Result, SeliumError};
use std::path::Path;
use std::sync::Arc;
use tokio::sync::Mutex;
Expand Down Expand Up @@ -100,15 +102,20 @@ impl ClientBuilder<CustomWantsConnect> {
endpoint,
root_store,
} = self.state;
if endpoint == SELIUM_CLOUD_REMOTE_URL {
return Err(SeliumError::ConnectDirectToCloud);
}

let ClientCommon {
keep_alive,
backoff_strategy,
} = common;

let options = ConnectionOptions::new(certs.as_slice(), key, root_store, keep_alive);

logging::connection::connect_to_address(&endpoint);
let connection = ClientConnection::connect(&endpoint, options).await?;
let connection = Arc::new(Mutex::new(connection));
logging::connection::successful_connection(&endpoint);

Ok(Client {
connection,
Expand Down
Loading

0 comments on commit 05b03cb

Please sign in to comment.