pub struct CheckpointCoordinator { /* private fields */ }Expand description
Central checkpoint coordinator.
Manages the lifecycle of periodic checkpoints: scheduling, barrier initiation, acknowledgement collection, and storage of completed snapshots.
Implementations§
Source§impl CheckpointCoordinator
impl CheckpointCoordinator
Sourcepub fn new(interval: Duration) -> Self
pub fn new(interval: Duration) -> Self
Create a coordinator with the given checkpoint interval.
Sourcepub fn with_max_retained(self, n: usize) -> Self
pub fn with_max_retained(self, n: usize) -> Self
Override the maximum number of retained completed checkpoints.
Sourcepub fn with_operator_timeout(self, timeout: Duration) -> Self
pub fn with_operator_timeout(self, timeout: Duration) -> Self
Override the per-operator acknowledgement timeout.
Sourcepub fn register_operator(&mut self, operator_id: String)
pub fn register_operator(&mut self, operator_id: String)
Register an operator that must participate in every checkpoint.
Sourcepub fn register_operators(
&mut self,
operator_ids: impl IntoIterator<Item = String>,
)
pub fn register_operators( &mut self, operator_ids: impl IntoIterator<Item = String>, )
Register multiple operators at once.
Sourcepub fn should_checkpoint(&self) -> bool
pub fn should_checkpoint(&self) -> bool
Returns true if enough time has elapsed and no checkpoint is in
progress.
Sourcepub fn initiate(&mut self) -> Result<u64, StreamError>
pub fn initiate(&mut self) -> Result<u64, StreamError>
Initiate a new checkpoint.
The returned checkpoint_id should be forwarded to all registered
operators as a barrier token.
Returns an error if a checkpoint is already in progress.
Sourcepub fn operator_reported(
&mut self,
snapshot: OperatorSnapshot,
) -> Result<bool, StreamError>
pub fn operator_reported( &mut self, snapshot: OperatorSnapshot, ) -> Result<bool, StreamError>
Called by an operator after it has snapshotted its state.
Returns true when all operators have acknowledged (checkpoint
complete).
Sourcepub fn abort(&mut self, reason: &str)
pub fn abort(&mut self, reason: &str)
Abort the in-progress checkpoint, transitioning back to Idle.
Sourcepub fn reset_to_idle(&mut self)
pub fn reset_to_idle(&mut self)
Reset from a Failed or Completed phase back to Idle.
Sourcepub fn latest_checkpoint(&self) -> Option<&GlobalCheckpoint>
pub fn latest_checkpoint(&self) -> Option<&GlobalCheckpoint>
Return a reference to the most recent completed checkpoint.
Sourcepub fn get_checkpoint(&self, id: u64) -> Option<&GlobalCheckpoint>
pub fn get_checkpoint(&self, id: u64) -> Option<&GlobalCheckpoint>
Return a reference to a completed checkpoint by ID.
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Number of retained completed checkpoints.
Sourcepub fn current_checkpoint_id(&self) -> Option<u64>
pub fn current_checkpoint_id(&self) -> Option<u64>
The checkpoint ID currently in progress, if any.
Sourcepub fn phase(&self) -> &CheckpointPhase
pub fn phase(&self) -> &CheckpointPhase
Current phase (for diagnostics).
Sourcepub fn pending_operators(&self) -> Option<Vec<String>>
pub fn pending_operators(&self) -> Option<Vec<String>>
Pending operator acknowledgements for the in-progress checkpoint.
Returns None if no checkpoint is in progress.
Auto Trait Implementations§
impl Freeze for CheckpointCoordinator
impl RefUnwindSafe for CheckpointCoordinator
impl Send for CheckpointCoordinator
impl Sync for CheckpointCoordinator
impl Unpin for CheckpointCoordinator
impl UnsafeUnpin for CheckpointCoordinator
impl UnwindSafe for CheckpointCoordinator
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.