Skip to content

Commit

Permalink
Allow APIs to bind different versions of the binary serialization format
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Mar 29, 2024
1 parent 26e1365 commit a58c1b4
Show file tree
Hide file tree
Showing 13 changed files with 801 additions and 497 deletions.
37 changes: 13 additions & 24 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tracing-futures = "0.2"
tracing-log = "0.2"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
url = "2.5.0"
versioned-binary-serialization = { git = "https://github.com/EspressoSystems/versioned-binary-serialization.git", tag = "0.1.2" }
vbs = { git = "https://github.com/EspressoSystems/versioned-binary-serialization.git", tag = "v0.1.4" }

# Dependencies enabled by feature `testing`
async-compatibility-layer = { git = "https://github.com/EspressoSystems/async-compatibility-layer.git", tag = "1.4.2", features = ["logging-utils"], optional = true }
Expand Down
5 changes: 2 additions & 3 deletions examples/hello-world/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ use snafu::Snafu;
use std::io;
use tide_disco::{Api, App, Error, RequestError, StatusCode};
use tracing::info;
use versioned_binary_serialization::version::StaticVersion;
use vbs::version::StaticVersion;

type StaticVer01 = StaticVersion<0, 1>;
const STATIC_VER: StaticVer01 = StaticVersion {};

#[derive(Clone, Debug, Deserialize, Serialize, Snafu)]
enum HelloError {
Expand Down Expand Up @@ -79,7 +78,7 @@ async fn serve(port: u16) -> io::Result<()> {
.unwrap();

app.register_module("hello", api).unwrap();
app.serve(format!("0.0.0.0:{}", port), STATIC_VER).await
app.serve(format!("0.0.0.0:{}", port)).await
}

#[async_std::main]
Expand Down
5 changes: 2 additions & 3 deletions examples/versions/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
use futures::FutureExt;
use std::io;
use tide_disco::{error::ServerError, Api, App};
use versioned_binary_serialization::version::StaticVersion;
use vbs::version::StaticVersion;

type StaticVer01 = StaticVersion<0, 1>;
const STATIC_VER: StaticVer01 = StaticVersion {};

async fn serve(port: u16) -> io::Result<()> {
let mut app = App::<_, ServerError, StaticVer01>::with_state(());
Expand All @@ -32,7 +31,7 @@ async fn serve(port: u16) -> io::Result<()> {
.unwrap()
.register_module("api", v2)
.unwrap();
app.serve(format!("0.0.0.0:{}", port), STATIC_VER).await
app.serve(format!("0.0.0.0:{}", port)).await
}

#[async_std::main]
Expand Down
Loading

0 comments on commit a58c1b4

Please sign in to comment.