Skip to main content

datum_persistence/
lib.rs

1#![forbid(unsafe_code)]
2//! Event sourcing, durable state, and CQRS persistence for Datum.
3//!
4//! The crate provides byte-oriented storage SPIs for event journals, snapshots,
5//! and durable state, together with a conformant in-memory reference backend.
6//! Serialization is synchronous and selected explicitly through a per-type
7//! [`SerializerCatalog`]; the optional default `protobuf` feature supplies
8//! `ProstSerializer` without exposing protobuf types in the
9//! feature-independent façade.
10
11pub mod backend;
12mod behavior;
13mod durable;
14mod error;
15mod id;
16mod journal;
17pub mod query;
18mod serialization;
19#[cfg(feature = "sharding")]
20pub mod sharding;
21mod snapshot;
22pub mod state;
23pub mod testkit;
24
25#[cfg(feature = "cassandra")]
26pub use backend::cassandra::{
27    CassandraPersistence, CassandraPersistenceConfig, CassandraPollingConfig, CassandraTableNames,
28    CassandraWriteMode,
29};
30pub use backend::{MemoryDurableStateStore, MemoryJournal, MemorySnapshotStore};
31#[cfg(feature = "postgres")]
32pub use backend::{
33    PostgresDeletePolicy, PostgresGroupCommitConfig, PostgresPersistence,
34    PostgresPersistenceConfig, PostgresPollingConfig, PostgresTableNames,
35};
36#[cfg(feature = "rocksdb")]
37pub use backend::{RocksDbBackend, RocksDbDurability, RocksDbOptions};
38pub use behavior::{
39    Effect, EventSourcedBehavior, EventSourcedHandle, EventSourcedMessage, EventSourcedRuntime,
40    EventSourcedSignal, EventSourcedState, IntoEventHandlerResult, PublishedEvent, Recovery,
41    ReplyEffect, RetentionCriteria, SnapshotSelection,
42};
43pub use durable::{DurableStateStore, VersionedState};
44pub use error::{AppendOutcome, PersistenceError, PersistenceResult};
45pub use id::{DEFAULT_PERSISTENCE_ID_SEPARATOR, PersistenceId, Revision, SequenceNr, Tag};
46pub use journal::{AtomicWrite, EventStream, Journal, ReplayRange, StoredEvent};
47#[cfg(feature = "protobuf")]
48pub use serialization::ProstSerializer;
49pub use serialization::{
50    EventAdapter, IdentityAdapter, PersistenceSerializer, SerializedPayload, SerializerCatalog,
51    SerializerId, StateAdapter,
52};
53pub use snapshot::{SelectedSnapshot, SnapshotCriteria, SnapshotMetadata, SnapshotStore};
54pub use testkit::{
55    FailingJournal, assert_durable_state_store_conformance, assert_journal_conformance,
56    assert_snapshot_store_conformance,
57};