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: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ chrono = "0.4"
serde_json = "1"
tokio = { version = "1", features = ["full"] }
futures-util = "0.3"
anyhow = "1"
4 changes: 2 additions & 2 deletions eventastic/src/aggregate/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ where

/// This error is returned when the Repository fails to insert the event
/// because the version already exists, indicating a concurrent modification.
#[error("Optimistic Concurrency Error Version {1} of aggregate {0:?} already exists")]
#[error("Optimistic Concurrency Error")]
OptimisticConcurrency(T::AggregateId, u64),
}

Expand Down Expand Up @@ -426,7 +426,7 @@ mod tests {
assert_eq!(context.version(), 0);

for i in 1..=5 {
let add_event = create_add_event(&format!("add-{}", i), i);
let add_event = create_add_event(&format!("add-{i}"), i);
context.record_that(add_event).unwrap();
assert_eq!(context.version(), i as u64);
}
Expand Down
2 changes: 1 addition & 1 deletion eventastic/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
) -> Option<EventStoreEvent<T::DomainEvent>> {
let storage = self.storage.lock().unwrap();

if let Some((stored_aggregate_id, version)) = storage.events_by_id.get(event_id) {

Check warning on line 206 in eventastic/src/memory.rs

View workflow job for this annotation

GitHub Actions / Clippy Lint

this `if` statement can be collapsed
if stored_aggregate_id == aggregate_id {

Check warning on line 207 in eventastic/src/memory.rs

View workflow job for this annotation

GitHub Actions / Clippy Lint

this `if` statement can be collapsed
if let Some(aggregate_events) = storage.events.get(aggregate_id) {
return aggregate_events.get(version).cloned();
}
Expand Down Expand Up @@ -407,7 +407,7 @@
}

// Check for version conflicts (optimistic concurrency)
if let Some(aggregate_events) = storage.events.get(id) {

Check warning on line 410 in eventastic/src/memory.rs

View workflow job for this annotation

GitHub Actions / Clippy Lint

this `if` statement can be collapsed
if aggregate_events.contains_key(&event.version) {
return Err(InMemoryError::VersionConflict {
expected: event.version,
Expand Down Expand Up @@ -870,7 +870,7 @@

// Verify side effects were stored
// Reset: 2 side effects, Add: 1, Subtract: 1, Multiply: 0, Add: 1 = 5 total
let expected_side_effects = 2 + 1 + 1 + 0 + 1;
let expected_side_effects = 5;
assert_eq!(repository.side_effects_count(), expected_side_effects);

let side_effects = repository.get_all_side_effects();
Expand Down
14 changes: 6 additions & 8 deletions eventastic/src/test_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
//! that can be used across different test modules to ensure consistency
//! and reduce code duplication.

#![cfg(test)]

use crate::{
aggregate::{Aggregate, SideEffect},
event::DomainEvent,
Expand Down Expand Up @@ -139,21 +137,21 @@ impl Aggregate for TestCounter {
match event {
TestEvent::Reset { event_id, .. } => Some(vec![
TestSideEffect::LogOperation {
id: format!("{}-log", event_id),
id: format!("{event_id}-log"),
operation: "Reset".to_string(),
},
TestSideEffect::NotifyUser {
id: format!("{}-notify", event_id),
id: format!("{event_id}-notify"),
message: "Counter has been reset".to_string(),
},
]),
TestEvent::Add { event_id, value } => Some(vec![TestSideEffect::LogOperation {
id: format!("{}-log", event_id),
operation: format!("Add {}", value),
id: format!("{event_id}-log"),
operation: format!("Add {value}"),
}]),
TestEvent::Subtract { event_id, value } => Some(vec![TestSideEffect::LogOperation {
id: format!("{}-log", event_id),
operation: format!("Subtract {}", value),
id: format!("{event_id}-log"),
operation: format!("Subtract {value}"),
}]),
TestEvent::Multiply { .. } => None, // No side effects for multiply
}
Expand Down
2 changes: 1 addition & 1 deletion eventastic_outbox_postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.5.0"
edition = "2024"

[dependencies]
anyhow = { workspace = true }
eventastic_postgres = { version = "0.5", path = "../eventastic_postgres" }
async-trait = { workspace = true }
sqlx = { workspace = true }
Expand All @@ -13,3 +12,4 @@ uuid = { workspace = true }
eventastic = { path = "../eventastic", version = "0.5" }
futures-util = { workspace = true }
tokio = { workspace = true }
thiserror = { workspace = true }
Loading
Loading