Skip to main content

ObjectStoreCheckpointStore

Struct ObjectStoreCheckpointStore 

Source
pub struct ObjectStoreCheckpointStore { /* private fields */ }
Expand description

Object-store-backed checkpoint store.

Drives any object_store::ObjectStore backend (S3, GCS, Azure, local FS) directly over .await; no dedicated runtime. The app runtime’s HTTP connection pool is reused.

§Object Layout

{prefix}/
  manifests/
    manifest-000001.json    # Checkpoint manifest (JSON)
    manifest-000002.json
    latest.json             # {"checkpoint_id": 2}
  checkpoints/
    state-000001.bin        # Optional sidecar state
    state-000002.bin

Manifest writes use [PutMode::Create] for split-brain prevention (conditional PUT).

Implementations§

Source§

impl ObjectStoreCheckpointStore

Source

pub fn new( store: Arc<dyn ObjectStore>, prefix: String, max_retained: usize, ) -> Self

Create a new object-store-backed checkpoint store.

prefix is prepended to all object paths (e.g., "nodes/abc123/"). It should end with / or be empty.

The store’s vnode_count defaults to crate::checkpoint_manifest::DEFAULT_VNODE_COUNT. Hosts that run with a non-default value should chain Self::with_vnode_count.

Source

pub fn with_vnode_count(self, vnode_count: u16) -> Self

Override the vnode_count used during manifest validation.

Trait Implementations§

Source§

impl CheckpointStore for ObjectStoreCheckpointStore

Source§

fn vnode_count(&self) -> u16

Runtime vnode count that manifests written by this store are expected to use. Consulted when validating loaded manifests — a mismatch is reported as a manifest warning. Defaults to crate::checkpoint_manifest::DEFAULT_VNODE_COUNT when the implementation has no configured value.
Source§

fn save<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically persists a checkpoint manifest. Implementations must guarantee readers never observe a partial manifest. Read more
Source§

fn update_manifest<'life0, 'life1, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Overwrites an existing manifest, bypassing the conditional-PUT fence used by Self::save. Used after a successful sink commit to record per-sink status transitions. Read more
Source§

fn load_latest<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads the most recent checkpoint manifest, or Ok(None) on a fresh store. Read more
Source§

fn load_by_id<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<CheckpointManifest>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads a specific manifest, or Ok(None) if absent. Read more
Source§

fn list_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all checkpoint IDs, sorted ascending. Unlike Self::list this enumerates corrupt manifests too (used by crash recovery). Callers rely on the ascending invariant. Read more
Source§

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all available checkpoints as (id, epoch) pairs, sorted ascending by ID. May read every manifest; callers that only need IDs should use Self::list_ids. Read more
Source§

fn prune<'life0, 'async_trait>( &'life0 self, keep_count: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Prunes old checkpoints, keeping at most keep_count recent ones. Returns the number of checkpoints removed. Read more
Source§

fn save_state_data<'life0, 'life1, 'async_trait>( &'life0 self, id: u64, chunks: &'life1 [Bytes], ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes operator state sidecar bytes for a checkpoint. Read more
Source§

fn load_state_data<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads operator state sidecar bytes for a checkpoint, or Ok(None) if no sidecar was written. Read more
Source§

fn cleanup_orphans<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete orphaned state files that have no matching manifest. Read more
Source§

fn validate_checkpoint<'life0, 'async_trait>( &'life0 self, id: u64, ) -> Pin<Box<dyn Future<Output = Result<ValidationResult, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validate a specific checkpoint’s integrity. Read more
Source§

fn recover_latest_validated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RecoveryReport, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Walk backward from latest to find the first valid checkpoint. Read more
Source§

fn save_with_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, manifest: &'life1 CheckpointManifest, state_data: Option<&'life2 [Bytes]>, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically saves a checkpoint manifest with optional sidecar state data. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more