pub struct AssignmentSnapshotStore { /* private fields */ }Expand description
I/O wrapper for AssignmentSnapshot on an object store.
Implementations§
Source§impl AssignmentSnapshotStore
impl AssignmentSnapshotStore
Sourcepub async fn load(&self) -> Result<Option<AssignmentSnapshot>, SnapshotError>
pub async fn load(&self) -> Result<Option<AssignmentSnapshot>, SnapshotError>
Load the current (highest-versioned) snapshot; Ok(None) on
fresh cluster.
§Errors
Object-store I/O or JSON decode failure.
Sourcepub async fn load_version(
&self,
version: u64,
) -> Result<Option<AssignmentSnapshot>, SnapshotError>
pub async fn load_version( &self, version: u64, ) -> Result<Option<AssignmentSnapshot>, SnapshotError>
Load a specific version’s snapshot. Ok(None) if that version
was never written or has been pruned.
§Errors
Object-store I/O or JSON decode failure.
Sourcepub async fn save_if_absent(
&self,
snapshot: &AssignmentSnapshot,
) -> Result<Option<AssignmentSnapshot>, SnapshotError>
pub async fn save_if_absent( &self, snapshot: &AssignmentSnapshot, ) -> Result<Option<AssignmentSnapshot>, SnapshotError>
CAS-create the object for snapshot.version. Ok(None) means
another writer landed there first. Used for both the initial
seed and for rotations (via Self::save_if_version).
§Errors
Object-store I/O or JSON encode failure.
Sourcepub async fn save_if_version(
&self,
snapshot: &AssignmentSnapshot,
prior_version: u64,
) -> Result<RotateOutcome, SnapshotError>
pub async fn save_if_version( &self, snapshot: &AssignmentSnapshot, prior_version: u64, ) -> Result<RotateOutcome, SnapshotError>
Rotate to snapshot assuming the current durable version is
prior_version. Returns RotateOutcome::Conflict carrying
the winner’s snapshot if a racer produced prior_version + 1
first.
§Errors
Object-store I/O, JSON encode, or a non-monotonic version bump (caller bug).
Sourcepub async fn prune_before(&self, before: u64) -> Result<(), SnapshotError>
pub async fn prune_before(&self, before: u64) -> Result<(), SnapshotError>
Delete every snapshot object with version < before.
Idempotent — missing objects are tolerated.
§Errors
Object-store I/O.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AssignmentSnapshotStore
impl !RefUnwindSafe for AssignmentSnapshotStore
impl Send for AssignmentSnapshotStore
impl Sync for AssignmentSnapshotStore
impl Unpin for AssignmentSnapshotStore
impl UnsafeUnpin for AssignmentSnapshotStore
impl !UnwindSafe for AssignmentSnapshotStore
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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