From 1b75cbfd549466f63d85aeb403adde4b9c4f999d Mon Sep 17 00:00:00 2001 From: Danilo Cianfrone Date: Sun, 12 Nov 2023 11:33:55 +0100 Subject: [PATCH 1/2] chore: update dependencies --- Cargo.toml | 1 + eventually-macros/Cargo.toml | 4 +-- eventually-postgres/Cargo.toml | 28 +++++++++------ eventually-postgres/src/aggregate.rs | 8 ++--- eventually-postgres/src/event.rs | 8 ++--- eventually/Cargo.toml | 32 ++++++++++------- examples/bank-accounting/Cargo.toml | 46 ++++++++++++++---------- examples/bank-accounting/src/main.rs | 4 +-- examples/bank-accounting/src/postgres.rs | 5 ++- 9 files changed, 78 insertions(+), 58 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8672c7e2..e27f71d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "eventually", "eventually-macros", diff --git a/eventually-macros/Cargo.toml b/eventually-macros/Cargo.toml index d94c831f..c083ee6a 100644 --- a/eventually-macros/Cargo.toml +++ b/eventually-macros/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" proc-macro = true [dependencies] -syn = { version = "1.0", features = ["full"] } -quote = "1.0" +syn = { version = "1.0.109", features = ["full"] } +quote = "1.0.33" eventually = { path = "../eventually" } diff --git a/eventually-postgres/Cargo.toml b/eventually-postgres/Cargo.toml index b5a3fa02..2b0c8f4f 100644 --- a/eventually-postgres/Cargo.toml +++ b/eventually-postgres/Cargo.toml @@ -12,18 +12,26 @@ categories = ["web-programming", "asynchronous"] keywords = ["postgres", "postgresql", "database", "ddd", "event-sourcing"] [dependencies] -async-trait = "0.1.57" -chrono = "0.4.22" -eventually = { path = "../eventually", version = "0.5.0", features = ["serde-json"] } -futures = "0.3.24" +async-trait = "0.1.74" +chrono = "0.4.31" +eventually = { path = "../eventually", version = "0.5.0", features = [ + "serde-json", +] } +futures = "0.3.29" lazy_static = "1.4.0" -regex = "1.6.0" -sqlx = { version = "0.6.2", features = [ "runtime-tokio-rustls" , "postgres", "migrate" ] } -thiserror = "1.0.36" +regex = "1.10.2" +sqlx = { version = "0.7.2", features = [ + "runtime-tokio-rustls", + "postgres", + "migrate", +] } +thiserror = "1.0.50" [dev-dependencies] -tokio = { version = "1.21.1", features = ["macros", "rt"] } -eventually = { path = "../eventually", version = "0.5.0", features = ["serde-json"] } +tokio = { version = "1.34.0", features = ["macros", "rt"] } +eventually = { path = "../eventually", version = "0.5.0", features = [ + "serde-json", +] } eventually-macros = { path = "../eventually-macros", version = "0.1.0" } -serde = { version = "1.0.130", features = ["derive"] } +serde = { version = "1.0.192", features = ["derive"] } rand = "0.8.5" diff --git a/eventually-postgres/src/aggregate.rs b/eventually-postgres/src/aggregate.rs index e945c082..edbb5a2e 100644 --- a/eventually-postgres/src/aggregate.rs +++ b/eventually-postgres/src/aggregate.rs @@ -118,7 +118,7 @@ where .bind(expected_version as i32) .bind(root.version() as i32) .bind(bytes_state) - .execute(tx) + .execute(&mut **tx) .await .map_err(|err| match crate::check_for_conflict_error(&err) { Some(err) => SaveError::Conflict(err), @@ -160,8 +160,8 @@ where let row = sqlx::query( r#"SELECT version, state - FROM aggregates - WHERE aggregate_id = $1 AND "type" = $2"#, + FROM aggregates + WHERE aggregate_id = $1 AND "type" = $2"#, ) .bind(&aggregate_id) .bind(T::type_name()) @@ -219,7 +219,7 @@ where .map_err(SaveError::BeginTransaction)?; sqlx::query("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE DEFERRABLE") - .execute(&mut tx) + .execute(&mut *tx) .await?; let aggregate_id = root.aggregate_id().to_string(); diff --git a/eventually-postgres/src/event.rs b/eventually-postgres/src/event.rs index 777f177f..252c8ccf 100644 --- a/eventually-postgres/src/event.rs +++ b/eventually-postgres/src/event.rs @@ -89,7 +89,7 @@ where .bind(event_version) .bind(serialized_event) .bind(sqlx::types::Json(metadata)) - .execute(tx) + .execute(&mut **tx) .await?; Ok(()) @@ -267,7 +267,7 @@ where .map_err(AppendError::BeginTransaction)?; sqlx::query("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE DEFERRABLE") - .execute(&mut tx) + .execute(&mut *tx) .await?; let string_id = id.to_string(); @@ -279,7 +279,7 @@ where sqlx::query("SELECT * FROM upsert_event_stream_with_no_version_check($1, $2)") .bind(&string_id) .bind(events_len) - .fetch_one(&mut tx) + .fetch_one(&mut *tx) .await .and_then(|row| row.try_get(0))? }, @@ -290,7 +290,7 @@ where .bind(&string_id) .bind(v as i32) .bind(new_version as i32) - .execute(&mut tx) + .execute(&mut *tx) .await .map_err(|err| match crate::check_for_conflict_error(&err) { Some(err) => AppendError::Conflict(err), diff --git a/eventually/Cargo.toml b/eventually/Cargo.toml index 28d9d8ff..49f08af0 100644 --- a/eventually/Cargo.toml +++ b/eventually/Cargo.toml @@ -8,7 +8,12 @@ license = "MIT" readme = "../README.md" repository = "https://github.com/get-eventually/eventually-rs" -categories = ["rust-patterns", "web-programming", "asynchronous", "data-structures"] +categories = [ + "rust-patterns", + "web-programming", + "asynchronous", + "data-structures", +] keywords = ["architecture", "ddd", "event-sourcing", "cqrs", "es"] [features] @@ -20,18 +25,19 @@ serde-protobuf = ["dep:protobuf", "dep:protobuf-json-mapping"] full = ["serde-prost", "serde-json", "serde-protobuf", "tracing"] [dependencies] -async-trait = "0.1.57" -futures = "0.3.24" -thiserror = "1.0.30" -prost = { version = "0.11.0", optional = true } -serde_json = { version = "1.0.69", optional = true } -serde = { version = "1.0.130", features = ["derive"] } -protobuf = { version = "3.2.0", optional = true } -protobuf-json-mapping = { version = "3.2.0", optional = true } -tracing = { version = "0.1.36", features = ["async-await"], optional = true } +async-trait = "0.1.74" +futures = "0.3.29" +thiserror = "1.0.50" +prost = { version = "0.12.1", optional = true } +serde_json = { version = "1.0.108", optional = true } +serde = { version = "1.0.192", features = ["derive"] } +protobuf = { version = "3.3.0", optional = true } +protobuf-json-mapping = { version = "3.3.0", optional = true } +tracing = { version = "0.1.40", features = ["async-await"], optional = true } [dev-dependencies] -anyhow = "1.0.51" # NOTE: this is only used for test components and assertions. +# NOTE: this is only used for test components and assertions. +anyhow = "1.0.75" lazy_static = "1.4.0" -serde_json = "1.0.69" -tokio = { version = "1.13.0", features = ["macros", "rt-multi-thread"] } +serde_json = "1.0.108" +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } diff --git a/examples/bank-accounting/Cargo.toml b/examples/bank-accounting/Cargo.toml index 917ce417..e8dfbbe1 100644 --- a/examples/bank-accounting/Cargo.toml +++ b/examples/bank-accounting/Cargo.toml @@ -6,28 +6,36 @@ readme = "README.md" publish = false [dependencies] -anyhow = "1.0.51" -async-trait = "0.1.52" -eventually = { path = "../../eventually", features = ["serde-prost", "tracing"] } +anyhow = "1.0.75" +async-trait = "0.1.74" +eventually = { path = "../../eventually", features = [ + "serde-prost", + "tracing", +] } eventually-macros = { path = "../../eventually-macros" } eventually-postgres = { path = "../../eventually-postgres" } -opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } -opentelemetry-jaeger = { version = "0.17.0", features = ["rt-tokio"] } -prost = "0.11.0" -rust_decimal = "1.18.0" -sqlx = { version = "0.6.2", features = [ "runtime-tokio-rustls" , "postgres" ] } -thiserror = "1.0.30" -tokio = { version = "1.13.0", features = ["macros", "rt-multi-thread"] } -tonic = { version = "0.8.1", features = ["gzip", "transport"] } -tonic-health = "0.8.0" -tonic-reflection = "0.6.0" -tower = "0.4.11" -tower-http = { version = "0.4.0", features = ["trace"] } -tracing = "0.1.29" -tracing-opentelemetry = "0.18.0" -tracing-subscriber = { version = "0.3.3", features = ["fmt", "std", "registry", "env-filter"] } +opentelemetry = "0.21.0" +opentelemetry-jaeger = "0.20.0" +prost = "0.12.1" +rust_decimal = "1.32.0" +sqlx = { version = "0.7.2", features = ["runtime-tokio-rustls", "postgres"] } +thiserror = "1.0.50" +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } +tonic = { version = "0.10.2", features = ["gzip", "transport"] } +tonic-health = "0.10.2" +tonic-reflection = "0.10.2" +tower = "0.4.13" +tower-http = { version = "0.4.4", features = ["trace"] } +tracing = "0.1.40" +tracing-opentelemetry = "0.22.0" +tracing-subscriber = { version = "0.3.17", features = [ + "fmt", + "std", + "registry", + "env-filter", +] } [dev-dependencies] [build-dependencies] -tonic-build = { version = "0.8.0", features = ["prost"] } +tonic-build = { version = "0.10.2", features = ["prost"] } diff --git a/examples/bank-accounting/src/main.rs b/examples/bank-accounting/src/main.rs index eb75a79e..a23729ad 100644 --- a/examples/bank-accounting/src/main.rs +++ b/examples/bank-accounting/src/main.rs @@ -34,9 +34,7 @@ async fn main() -> anyhow::Result<()> { let reflection_svc = tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(proto::FILE_DESCRIPTOR_SET) - .register_encoded_file_descriptor_set( - tonic_health::proto::GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET, - ) + .register_encoded_file_descriptor_set(tonic_health::pb::FILE_DESCRIPTOR_SET) .build() .map_err(|e| anyhow!("failed to build grpc reflection service: {}", e))?; diff --git a/examples/bank-accounting/src/postgres.rs b/examples/bank-accounting/src/postgres.rs index f34d3798..4406e4f0 100644 --- a/examples/bank-accounting/src/postgres.rs +++ b/examples/bank-accounting/src/postgres.rs @@ -12,9 +12,8 @@ pub async fn connect() -> anyhow::Result { .port(5432) .username("postgres") .password("password") - .ssl_mode(PgSslMode::Disable); - - connect_options.log_statements(LevelFilter::Debug); + .ssl_mode(PgSslMode::Disable) + .log_statements(LevelFilter::Debug); Ok(PgPool::connect_with(connect_options).await?) } From 8f41bd28e68a97d2e1167a47f44dbdb1ee9eca65 Mon Sep 17 00:00:00 2001 From: Danilo Cianfrone Date: Sun, 12 Nov 2023 11:34:19 +0100 Subject: [PATCH 2/2] fix(flake): add SystemConfiguration to buildInputs --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 433a52aa..80dfd54b 100644 --- a/flake.nix +++ b/flake.nix @@ -22,11 +22,15 @@ }; nativeBuildInputs = with pkgs; [ rust-bin.nightly.latest.default protobuf3_24 ]; + + buildInputs = with pkgs; [ pkg-config openssl ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.SystemConfiguration + ]; in with pkgs; { devShells.default = with pkgs; mkShell { - inherit nativeBuildInputs; + inherit nativeBuildInputs buildInputs; PROTOC = "${protobuf3_24}/bin/protoc"; };