Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"eventually",
"eventually-macros",
Expand Down
4 changes: 2 additions & 2 deletions eventually-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
28 changes: 18 additions & 10 deletions eventually-postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 4 additions & 4 deletions eventually-postgres/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions eventually-postgres/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where
.bind(event_version)
.bind(serialized_event)
.bind(sqlx::types::Json(metadata))
.execute(tx)
.execute(&mut **tx)
.await?;

Ok(())
Expand Down Expand Up @@ -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();
Expand All @@ -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))?
},
Expand All @@ -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),
Expand Down
32 changes: 19 additions & 13 deletions eventually/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"] }
46 changes: 27 additions & 19 deletions examples/bank-accounting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
4 changes: 1 addition & 3 deletions examples/bank-accounting/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?;

Expand Down
5 changes: 2 additions & 3 deletions examples/bank-accounting/src/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ pub async fn connect() -> anyhow::Result<PgPool> {
.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?)
}
6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Expand Down