pub trait CheckpointFlushObserver {
// Required methods
fn on_flush_start(&self, lease_id: u128);
fn on_flush_complete(&self, lease_id: u128);
}Expand description
Sideband observer notified at checkpoint flush start and complete.
Slice 96 wires this so the scheduler-service PreemptionManager
can mark a lease as NonPreemptibleReason::CheckpointInProgress
for the duration of a flush. The trait is intentionally minimal
and observational — implementations MUST NOT block, return errors
the flush can act on, or otherwise change the flush’s success
semantics. A failed observer notification (e.g. lease not tracked
by the preemption manager because it was released / expired /
fenced concurrently) is a sideband condition the observer logs
internally; it does NOT abort the checkpoint flush. The
checkpoint is the source of truth for stage durability; the
observer is a sideband signal to the scheduler.
Why a trait callback rather than a direct cross-crate call?
grafos-pipeline is no_std + alloc and intentionally has no
dependency on grafos-scheduler-service (which is std-only and
depends on the http server, audit chain, etc.). A direct call
would either force the pipeline crate into std or pull
scheduler-service into no_std builds. The trait keeps both
sides cycle-free: the producer (pipeline) calls a small trait;
the consumer (scheduler-service) implements it.
Lifecycle contract:
on_flush_start(lease_id)is called exactly ONCE at the beginning of acheckpoint()call when both the observer andlease_idare wired.on_flush_complete(lease_id)is called exactly ONCE at the end ofcheckpoint()— on BOTH the success path and every failure path. The implementation is responsible for the RAII guard via aDrop-based scope; producers don’t need to sprinkle clears at every error site.
Required Methods§
Sourcefn on_flush_start(&self, lease_id: u128)
fn on_flush_start(&self, lease_id: u128)
Called at the START of a checkpoint flush. Implementations should mark the lease as transiently non-preemptible.
Sourcefn on_flush_complete(&self, lease_id: u128)
fn on_flush_complete(&self, lease_id: u128)
Called at the END of a checkpoint flush (both success AND failure paths). Implementations should clear the non-preemptible marker.