pub struct TimedKeepsakeRepository<'repo, C = NoopRelationCache> { /* 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, C> TimedKeepsakeRepository<'repo, C>where
C: RelationCache,
impl<'repo, C> TimedKeepsakeRepository<'repo, C>where
C: RelationCache,
Sourcepub const fn repository(&self) -> &'repo KeepsakeRepository<C>
pub const fn repository(&self) -> &'repo KeepsakeRepository<C>
Returns the repository backing this timestamp-scoped view.
Sourcepub const fn timestamp(&self) -> DateTime<Utc>
pub const fn timestamp(&self) -> DateTime<Utc>
Returns the timestamp applied by forwarding methods.
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 apply(
&self,
subject: &SubjectRef,
relation_id: RelationId,
metadata: &BTreeMap<String, String>,
) -> RepositoryResult<AppliedKeepsake>
pub async fn apply( &self, subject: &SubjectRef, relation_id: RelationId, metadata: &BTreeMap<String, String>, ) -> RepositoryResult<AppliedKeepsake>
Applies a keepsake relation idempotently using this view’s timestamp.
Sourcepub async fn apply_spec<Spec>(
&self,
subject: &SubjectRef,
metadata: &BTreeMap<String, String>,
) -> RepositoryResult<AppliedKeepsake>where
Spec: RelationSpec,
pub async fn apply_spec<Spec>(
&self,
subject: &SubjectRef,
metadata: &BTreeMap<String, String>,
) -> RepositoryResult<AppliedKeepsake>where
Spec: RelationSpec,
Applies a typed keepsake relation idempotently using this view’s timestamp.
Sourcepub async fn apply_without_metadata(
&self,
subject: &SubjectRef,
relation_id: RelationId,
) -> RepositoryResult<AppliedKeepsake>
pub async fn apply_without_metadata( &self, subject: &SubjectRef, relation_id: RelationId, ) -> RepositoryResult<AppliedKeepsake>
Applies a keepsake relation with empty metadata using this view’s timestamp.
Sourcepub async fn apply_spec_without_metadata<Spec>(
&self,
subject: &SubjectRef,
) -> RepositoryResult<AppliedKeepsake>where
Spec: RelationSpec,
pub async fn apply_spec_without_metadata<Spec>(
&self,
subject: &SubjectRef,
) -> RepositoryResult<AppliedKeepsake>where
Spec: RelationSpec,
Applies a typed keepsake relation with empty metadata using this view’s timestamp.
Sourcepub async fn revoke(&self, keepsake_id: Uuid) -> RepositoryResult<bool>
pub async fn revoke(&self, keepsake_id: Uuid) -> RepositoryResult<bool>
Revokes an active keepsake 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 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.
Trait Implementations§
Source§impl<'repo, C: Clone> Clone for TimedKeepsakeRepository<'repo, C>
impl<'repo, C: Clone> Clone for TimedKeepsakeRepository<'repo, C>
Source§fn clone(&self) -> TimedKeepsakeRepository<'repo, C>
fn clone(&self) -> TimedKeepsakeRepository<'repo, 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, C: Copy> Copy for TimedKeepsakeRepository<'repo, C>
Auto Trait Implementations§
impl<'repo, C = NoopRelationCache> !RefUnwindSafe for TimedKeepsakeRepository<'repo, C>
impl<'repo, C = NoopRelationCache> !UnwindSafe for TimedKeepsakeRepository<'repo, C>
impl<'repo, C> Freeze for TimedKeepsakeRepository<'repo, C>
impl<'repo, C> Send for TimedKeepsakeRepository<'repo, C>where
C: Sync,
impl<'repo, C> Sync for TimedKeepsakeRepository<'repo, C>where
C: Sync,
impl<'repo, C> Unpin for TimedKeepsakeRepository<'repo, C>
impl<'repo, C> UnsafeUnpin for TimedKeepsakeRepository<'repo, 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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