pub struct TimedSqlxKeepsakeRepository<'repo, B, C = NoopRelationCache>where
B: KeepsakeSqlxBackend,{ /* private fields */ }Expand description
Timestamp-scoped repository view.
This wrapper does not read the system clock. Callers choose the timestamp once at an operation boundary, then use the forwarding methods to keep related writes and expiry scans on the same deterministic instant.
Implementations§
Source§impl<'repo, B, C> TimedSqlxKeepsakeRepository<'repo, B, C>where
B: KeepsakeSqlxBackend,
impl<'repo, B, C> TimedSqlxKeepsakeRepository<'repo, B, C>where
B: KeepsakeSqlxBackend,
Sourcepub const fn repository(&self) -> &'repo SqlxKeepsakeRepository<B, C>
pub const fn repository(&self) -> &'repo SqlxKeepsakeRepository<B, C>
Returns the repository backing this timestamp-scoped view.
Source§impl<C> TimedSqlxKeepsakeRepository<'_, PostgresBackend, C>where
C: RelationCache,
impl<C> TimedSqlxKeepsakeRepository<'_, PostgresBackend, C>where
C: RelationCache,
Sourcepub async fn upsert_relation(
&self,
relation: &RelationDefinition,
) -> RepositoryResult<RelationDefinition>
pub async fn upsert_relation( &self, relation: &RelationDefinition, ) -> RepositoryResult<RelationDefinition>
Inserts or updates a relation definition using this view’s timestamp.
Sourcepub async fn upsert_relation_spec<Spec>(
&self,
) -> RepositoryResult<RelationDefinition>where
Spec: RelationSpec,
pub async fn upsert_relation_spec<Spec>(
&self,
) -> RepositoryResult<RelationDefinition>where
Spec: RelationSpec,
Inserts or updates a typed relation spec using this view’s timestamp.
Sourcepub async fn set_relation_enabled(
&self,
relation_id: RelationId,
enabled: bool,
) -> RepositoryResult<bool>
pub async fn set_relation_enabled( &self, relation_id: RelationId, enabled: bool, ) -> RepositoryResult<bool>
Enables or disables a relation using this view’s timestamp.
Sourcepub async fn due_timed_expiry(
&self,
limit: i64,
) -> RepositoryResult<Vec<TimedExpiryCandidate>>
pub async fn due_timed_expiry( &self, limit: i64, ) -> RepositoryResult<Vec<TimedExpiryCandidate>>
Lists due timed expiry candidates using this view’s timestamp.
Sourcepub async fn expire_due_timed(&self, limit: i64) -> RepositoryResult<u64>
pub async fn expire_due_timed(&self, limit: i64) -> RepositoryResult<u64>
Expires a stable batch of due timed keepsakes using this view’s timestamp.
Sourcepub async fn fulfillment_snapshot(
&self,
keepsake_id: Uuid,
) -> RepositoryResult<FulfillmentSnapshot>
pub async fn fulfillment_snapshot( &self, keepsake_id: Uuid, ) -> RepositoryResult<FulfillmentSnapshot>
Reads the persisted fulfillment counter snapshot for a keepsake.
Sourcepub async fn due_fulfilled_expiry(
&self,
limit: i64,
) -> RepositoryResult<Vec<FulfilledExpiryCandidate>>
pub async fn due_fulfilled_expiry( &self, limit: i64, ) -> RepositoryResult<Vec<FulfilledExpiryCandidate>>
Lists fulfillment expiry candidates.
Sourcepub async fn expire_due_fulfilled(&self, limit: i64) -> RepositoryResult<u64>
pub async fn expire_due_fulfilled(&self, limit: i64) -> RepositoryResult<u64>
Expires fulfillment-satisfied keepsakes using this view’s timestamp.
Sourcepub async fn upsert_counter_projection(
&self,
keepsake_id: Uuid,
key: &str,
value: i64,
) -> RepositoryResult<()>
pub async fn upsert_counter_projection( &self, keepsake_id: Uuid, key: &str, value: i64, ) -> RepositoryResult<()>
Upserts a simple fulfillment counter projection using this view’s timestamp.
Sourcepub async fn increment_counter_projection(
&self,
keepsake_id: Uuid,
key: &str,
delta: i64,
) -> RepositoryResult<i64>
pub async fn increment_counter_projection( &self, keepsake_id: Uuid, key: &str, delta: i64, ) -> RepositoryResult<i64>
Atomically increments a fulfillment counter using this view’s timestamp.
Sourcepub async fn upsert_checklist_projection(
&self,
keepsake_id: Uuid,
item: &str,
complete: bool,
) -> RepositoryResult<()>
pub async fn upsert_checklist_projection( &self, keepsake_id: Uuid, item: &str, complete: bool, ) -> RepositoryResult<()>
Upserts a checklist item completion projection using this view’s timestamp.
Trait Implementations§
Source§impl<'repo, B, C: Clone> Clone for TimedSqlxKeepsakeRepository<'repo, B, C>where
B: KeepsakeSqlxBackend + Clone,
impl<'repo, B, C: Clone> Clone for TimedSqlxKeepsakeRepository<'repo, B, C>where
B: KeepsakeSqlxBackend + Clone,
Source§fn clone(&self) -> TimedSqlxKeepsakeRepository<'repo, B, C>
fn clone(&self) -> TimedSqlxKeepsakeRepository<'repo, B, C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'repo, B, C: Copy> Copy for TimedSqlxKeepsakeRepository<'repo, B, C>where
B: KeepsakeSqlxBackend + Copy,
Auto Trait Implementations§
impl<'repo, B, C = NoopRelationCache> !RefUnwindSafe for TimedSqlxKeepsakeRepository<'repo, B, C>
impl<'repo, B, C = NoopRelationCache> !UnwindSafe for TimedSqlxKeepsakeRepository<'repo, B, C>
impl<'repo, B, C> Freeze for TimedSqlxKeepsakeRepository<'repo, B, C>
impl<'repo, B, C> Send for TimedSqlxKeepsakeRepository<'repo, B, C>where
C: Sync,
impl<'repo, B, C> Sync for TimedSqlxKeepsakeRepository<'repo, B, C>where
C: Sync,
impl<'repo, B, C> Unpin for TimedSqlxKeepsakeRepository<'repo, B, C>
impl<'repo, B, C> UnsafeUnpin for TimedSqlxKeepsakeRepository<'repo, B, C>
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more