pub struct QueuedRepository<R, L = InMemoryLockManager> { /* private fields */ }Expand description
Repository wrapper that serializes access with process-local per-stream locks.
Locking reads (get and get_many) intentionally keep matching locks held
after returning. Call commit to release those locks after a successful
write, or call abort/unlock when the loaded entity is no longer being
written. Dropping a loaded entity without commit or abort leaves its
in-memory lock held until an explicit unlock.
Commit releases held locks only after the inner repository succeeds. On commit errors, locks remain held so callers can inspect state, retry, or explicitly abort.
Implementations§
Source§impl<R> QueuedRepository<R>
impl<R> QueuedRepository<R>
Source§impl<R, L> QueuedRepository<R, L>
impl<R, L> QueuedRepository<R, L>
Source§impl<R, L: LockManager> QueuedRepository<R, L>
impl<R, L: LockManager> QueuedRepository<R, L>
Sourcepub fn with_lock_manager(inner: R, lock_manager: L) -> Self
pub fn with_lock_manager(inner: R, lock_manager: L) -> Self
Create a QueuedRepository with a custom async lock manager.
Trait Implementations§
Source§impl<R: Clone, L> Clone for QueuedRepository<R, L>
impl<R: Clone, L> Clone for QueuedRepository<R, L>
Source§impl<R, L> GetAllWithOpts for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
impl<R, L> GetAllWithOpts for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
fn get_streams_with<'a>( &'a self, identities: &'a [StreamIdentity], opts: ReadOpts, ) -> impl Future<Output = Result<Vec<Entity>, RepositoryError>> + Send + 'a
Source§impl<R, L> GetStream for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
impl<R, L> GetStream for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
fn get_stream<'a>( &'a self, identity: &'a StreamIdentity, ) -> impl Future<Output = Result<Option<Entity>, RepositoryError>> + Send + 'a
Source§fn get_streams<'a>(
&'a self,
identities: &'a [StreamIdentity],
) -> impl Future<Output = Result<Vec<Entity>, RepositoryError>> + Send + 'a
fn get_streams<'a>( &'a self, identities: &'a [StreamIdentity], ) -> impl Future<Output = Result<Vec<Entity>, RepositoryError>> + Send + 'a
Load the streams for the provided identities, skipping missing ones. Read more
Source§fn get_stream_tail<'a>(
&'a self,
identity: &'a StreamIdentity,
after_version: u64,
) -> impl Future<Output = Result<Option<Entity>, RepositoryError>> + Send + 'a
fn get_stream_tail<'a>( &'a self, identity: &'a StreamIdentity, after_version: u64, ) -> impl Future<Output = Result<Option<Entity>, RepositoryError>> + Send + 'a
Load only the events with
sequence > after_version as a tail-only
Entity (see Entity::load_tail_from_history). Read moreSource§impl<R, L> GetWithOpts for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
impl<R, L> GetWithOpts for QueuedRepository<R, L>where
R: GetStream,
L: LockManager,
fn get_stream_with<'a>( &'a self, identity: &'a StreamIdentity, opts: ReadOpts, ) -> impl Future<Output = Result<Option<Entity>, RepositoryError>> + Send + 'a
Source§impl<R, L> HasOutboxStore for QueuedRepository<R, L>where
R: HasOutboxStore,
impl<R, L> HasOutboxStore for QueuedRepository<R, L>where
R: HasOutboxStore,
Source§type OutboxStore = <R as HasOutboxStore>::OutboxStore
type OutboxStore = <R as HasOutboxStore>::OutboxStore
The concrete outbox store this repository produces.
Source§fn outbox_store(&self) -> Self::OutboxStore
fn outbox_store(&self) -> Self::OutboxStore
Produce a handle to the durable outbox store.
Source§impl<R, L> InboxStore for QueuedRepository<R, L>where
R: InboxStore,
L: LockManager,
impl<R, L> InboxStore for QueuedRepository<R, L>where
R: InboxStore,
L: LockManager,
fn inbox_contains<'a>( &'a self, consumer: &'a str, message_id: &'a str, ) -> impl Future<Output = Result<bool, RepositoryError>> + Send + 'a
Source§fn purge_inbox_older_than(
&self,
age: Duration,
) -> impl Future<Output = Result<u64, RepositoryError>> + Send
fn purge_inbox_older_than( &self, age: Duration, ) -> impl Future<Output = Result<u64, RepositoryError>> + Send
Purge inbox receipts older than
age, returning the number removed. Read moreSource§impl<R, L> ReadModelWritePlanStore for QueuedRepository<R, L>where
R: ReadModelWritePlanStore,
L: LockManager,
impl<R, L> ReadModelWritePlanStore for QueuedRepository<R, L>where
R: ReadModelWritePlanStore,
L: LockManager,
fn read_model_capabilities(&self) -> TableAdapterCapabilities
fn commit_write_plan( &self, plan: TableWritePlan, ) -> impl Future<Output = Result<TableCommitOutcome, TableStoreError>> + Send + '_
Source§impl<R, L> RelationalReadModelQueryStore for QueuedRepository<R, L>where
R: RelationalReadModelQueryStore,
L: LockManager,
impl<R, L> RelationalReadModelQueryStore for QueuedRepository<R, L>where
R: RelationalReadModelQueryStore,
L: LockManager,
fn read_model_query_capabilities(&self) -> ReadModelQueryCapabilities
fn load_graph( &self, request: ReadModelLoadRequest, ) -> impl Future<Output = Result<ReadModelLoadGraph, TableStoreError>> + Send + '_
Source§impl<R, L> SnapshotStore for QueuedRepository<R, L>where
R: SnapshotStore,
L: LockManager,
impl<R, L> SnapshotStore for QueuedRepository<R, L>where
R: SnapshotStore,
L: LockManager,
fn get_snapshot<'a>( &'a self, identity: &'a StreamIdentity, ) -> impl Future<Output = Result<Option<SnapshotRecord>, RepositoryError>> + Send + 'a
Source§fn get_snapshots<'a>(
&'a self,
identities: &'a [StreamIdentity],
) -> impl Future<Output = Result<Vec<SnapshotRecord>, RepositoryError>> + Send + 'a
fn get_snapshots<'a>( &'a self, identities: &'a [StreamIdentity], ) -> impl Future<Output = Result<Vec<SnapshotRecord>, RepositoryError>> + Send + 'a
Load the snapshots for the provided identities, skipping identities
without one. Each returned record carries its own aggregate type/id, so
callers can pair records back to identities. Read more
fn save_snapshot<'a>( &'a self, identity: &'a StreamIdentity, record: SnapshotRecord, ) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
fn delete_snapshot<'a>( &'a self, identity: &'a StreamIdentity, ) -> impl Future<Output = Result<bool, RepositoryError>> + Send + 'a
Source§impl<R, L> TransactionalCommit for QueuedRepository<R, L>where
R: TransactionalCommit,
L: LockManager,
impl<R, L> TransactionalCommit for QueuedRepository<R, L>where
R: TransactionalCommit,
L: LockManager,
fn commit_batch<'a>( &'a self, batch: CommitBatch<'a>, ) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
Source§impl<R, L: LockManager> UnlockableRepository for QueuedRepository<R, L>
impl<R, L: LockManager> UnlockableRepository for QueuedRepository<R, L>
Source§fn unlock<'a>(
&'a self,
identity: &'a StreamIdentity,
) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
fn unlock<'a>( &'a self, identity: &'a StreamIdentity, ) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
Release the lock held for a stream. Read more
Source§fn abort<'a>(
&'a self,
identity: &'a StreamIdentity,
) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
fn abort<'a>( &'a self, identity: &'a StreamIdentity, ) -> impl Future<Output = Result<(), RepositoryError>> + Send + 'a
Release a lock for an aborted load (alias for
unlock).Auto Trait Implementations§
impl<R, L> Freeze for QueuedRepository<R, L>
impl<R, L> RefUnwindSafe for QueuedRepository<R, L>
impl<R, L> Send for QueuedRepository<R, L>
impl<R, L> Sync for QueuedRepository<R, L>
impl<R, L> Unpin for QueuedRepository<R, L>
impl<R, L> UnsafeUnpin for QueuedRepository<R, L>
impl<R, L> UnwindSafe for QueuedRepository<R, L>
Blanket Implementations§
Source§impl<T> AggregateBuilder for T
impl<T> AggregateBuilder for T
fn aggregate<A: Aggregate>(self) -> AggregateRepository<Self, A>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R> CommitBuilderExt for Rwhere
R: TransactionalCommit,
impl<R> CommitBuilderExt for Rwhere
R: TransactionalCommit,
Source§fn outbox(&self, msg: OutboxMessage) -> CommitBuilder<'_, Self>
fn outbox(&self, msg: OutboxMessage) -> CommitBuilder<'_, Self>
Start an async commit builder chain with an outbox message.
Source§impl<S> HasReadModelStore for Swhere
S: ReadModelWritePlanStore + RelationalReadModelQueryStore,
impl<S> HasReadModelStore for Swhere
S: ReadModelWritePlanStore + RelationalReadModelQueryStore,
type ReadModelStore = S
fn read_model_store(&self) -> &<S as HasReadModelStore>::ReadModelStore
Source§impl<R> HasRepo for Rwhere
R: Repository,
impl<R> HasRepo for Rwhere
R: Repository,
Source§impl<T> Queueable for T
impl<T> Queueable for T
Source§fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
Wrap with the default async lock manager. Pair with
.aggregate::<T>() for per-aggregate serialization over the async
repository surface.Source§fn queued_with<L: LockManager>(
self,
lock_manager: L,
) -> QueuedRepository<Self, L>
fn queued_with<L: LockManager>( self, lock_manager: L, ) -> QueuedRepository<Self, L>
Wrap with a custom async lock manager.
Source§impl<S> ReadModelWorkspaceExt for Swhere
S: ReadModelWritePlanStore + RelationalReadModelQueryStore,
impl<S> ReadModelWorkspaceExt for Swhere
S: ReadModelWritePlanStore + RelationalReadModelQueryStore,
fn workspace(&self) -> ReadModelWorkspace<'_, Self>
Source§impl<R> ReadModelWritePlanCommitExt for Rwhere
R: TransactionalCommit,
impl<R> ReadModelWritePlanCommitExt for Rwhere
R: TransactionalCommit,
Source§fn read_models(
&self,
read_models: ReadModelWritePlanBuilder,
) -> CommitBuilder<'_, Self>
fn read_models( &self, read_models: ReadModelWritePlanBuilder, ) -> CommitBuilder<'_, Self>
Start an async commit builder chain with a relational read-model write plan.