Skip to main content

Crate sourcery_core

Crate sourcery_core 

Source
Expand description

Core traits and types for the Sourcery event-sourcing library.

This crate provides the foundational abstractions for event sourcing:

  • aggregate - Command-side primitives (Aggregate, Apply, Handle)
  • projection - Read-side primitives (Projection, ProjectionFilters, ApplyProjection, Filters)
  • repository - Command execution and aggregate lifecycle (Repository)
  • store - Event persistence abstraction (EventStore)
  • snapshot - Snapshot storage abstraction (SnapshotStore)
  • event - Event marker traits (DomainEvent, EventKind, ProjectionEvent)
  • concurrency - Concurrency strategy markers (Optimistic, Unchecked)

§Example

use sourcery_core::{repository::Repository, store::inmemory};

// Create an in-memory store and repository
let store: inmemory::Store<String, ()> = inmemory::Store::new();
let repo = Repository::new(store);

Most users should depend on the sourcery crate, which re-exports these types with a cleaner API surface.

Modules§

aggregate
Command-side domain primitives.
concurrency
Compile-time concurrency strategy selection.
event
Domain event marker.
projection
Read-side primitives.
repository
Command execution and aggregate lifecycle management.
snapshot
Snapshot support for optimised aggregate loading.
store
Persistence layer abstractions.
subscription
Push-based projection subscriptions.