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 projection;
18pub mod query;
19mod serialization;
20#[cfg(feature = "sharding")]
21pub mod sharding;
22mod snapshot;
23pub mod state;
24pub mod testkit;
25
26#[cfg(feature = "cassandra")]
27pub use backend::cassandra::{
28    CassandraPersistence, CassandraPersistenceConfig, CassandraPollingConfig, CassandraTableNames,
29    CassandraWriteMode,
30};
31pub use backend::{MemoryDurableStateStore, MemoryJournal, MemorySnapshotStore};
32#[cfg(feature = "postgres")]
33pub use backend::{
34    PostgresDeletePolicy, PostgresGroupCommitConfig, PostgresPersistence,
35    PostgresPersistenceConfig, PostgresPollingConfig, PostgresTableNames,
36};
37#[cfg(feature = "rocksdb")]
38pub use backend::{RocksDbBackend, RocksDbDurability, RocksDbOptions};
39pub use behavior::{
40    Effect, EventSourcedBehavior, EventSourcedHandle, EventSourcedMessage, EventSourcedRuntime,
41    EventSourcedSignal, EventSourcedState, IntoEventHandlerResult, PublishedEvent, Recovery,
42    ReplyEffect, RetentionCriteria, SnapshotSelection,
43};
44pub use durable::{DurableStateStore, VersionedState};
45pub use error::{AppendOutcome, PersistenceError, PersistenceResult};
46pub use id::{DEFAULT_PERSISTENCE_ID_SEPARATOR, PersistenceId, Revision, SequenceNr, Tag};
47pub use journal::{AtomicWrite, EventStream, Journal, ReplayRange, StoredEvent};
48#[cfg(feature = "protobuf")]
49pub use serialization::ProstSerializer;
50pub use serialization::{
51    EventAdapter, IdentityAdapter, PersistenceSerializer, SerializedPayload, SerializerCatalog,
52    SerializerId, StateAdapter,
53};
54pub use snapshot::{SelectedSnapshot, SnapshotCriteria, SnapshotMetadata, SnapshotStore};
55pub use testkit::{
56    FailingJournal, assert_durable_state_store_conformance, assert_journal_conformance,
57    assert_snapshot_store_conformance,
58};