Skip to content

Commit

Permalink
Merge pull request #205 from EspressoSystems/feat/api-vbs-version
Browse files Browse the repository at this point in the history
Allow APIs to bind different versions of the binary serialization format
  • Loading branch information
jbearer authored Apr 1, 2024
2 parents 0b464b8 + 395e64c commit 796cdc1
Show file tree
Hide file tree
Showing 13 changed files with 808 additions and 505 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 796cdc1

Please sign in to comment.