pub struct StoreCoordinator<S: CoordinationStore + Clone> { /* private fields */ }Expand description
A SplitCoordinator over any CoordinationStore.
Built with a multi-thread runtime handle (the background task and the store’s I/O live there; a current-thread runtime would deadlock the blocking replies and is rejected at construction).
Implementations§
Source§impl<S: CoordinationStore + Clone> StoreCoordinator<S>
impl<S: CoordinationStore + Clone> StoreCoordinator<S>
Sourcepub fn new(
store: S,
config: CoordinationConfig,
io: Handle,
metrics: Option<CoordinationMetrics>,
) -> Result<StoreCoordinator<S>, CoordinationError>
pub fn new( store: S, config: CoordinationConfig, io: Handle, metrics: Option<CoordinationMetrics>, ) -> Result<StoreCoordinator<S>, CoordinationError>
Wrap a store. io must be a multi-thread runtime handle.
§Errors
Fatal on invalid configuration, a current-thread runtime, or a
store whose lease TTL diverges from config.lease_duration.
Sourcepub fn instance_id(&self) -> &str
pub fn instance_id(&self) -> &str
This worker’s (stable or generated) instance id.
Trait Implementations§
Source§impl<S: CoordinationStore + Clone> Debug for StoreCoordinator<S>
impl<S: CoordinationStore + Clone> Debug for StoreCoordinator<S>
Source§impl<S: CoordinationStore + Clone> Drop for StoreCoordinator<S>
impl<S: CoordinationStore + Clone> Drop for StoreCoordinator<S>
Source§impl<S: CoordinationStore + Clone> SplitCoordinator for StoreCoordinator<S>
impl<S: CoordinationStore + Clone> SplitCoordinator for StoreCoordinator<S>
Source§fn start(
&mut self,
planner: Box<dyn SplitPlanner>,
) -> Result<(), CoordinationError>
fn start( &mut self, planner: Box<dyn SplitPlanner>, ) -> Result<(), CoordinationError>
Join the job: verify the fingerprint, hand over this worker’s
planner (used only if and while this instance is elected leader),
and start the backend’s claim and renewal machinery. Called exactly
once, before any other method.
Source§fn set_waker(&mut self, waker: ControlWaker)
fn set_waker(&mut self, waker: ControlWaker)
Source§fn poll(&mut self) -> Result<Vec<CoordinationEvent>, CoordinationError>
fn poll(&mut self) -> Result<Vec<CoordinationEvent>, CoordinationError>
Ownership and job-state changes since the last call. Must not
block — return whatever is pending, including nothing. The driver
parks on the
ControlWaker instead.Source§fn commit(
&mut self,
split: &SplitId,
progress: &SplitProgress,
) -> Result<(), CoordinationError>
fn commit( &mut self, split: &SplitId, progress: &SplitProgress, ) -> Result<(), CoordinationError>
Fenced durable commit of one owned split’s progress.
Ok means
durable. Fenced means the split
is no longer owned and nothing was written — stop the split,
never retry the write. Retryable
leaves the previous committed state authoritative; re-committing
the merged progress on the next tick is idempotent. Read moreSource§fn fail(
&mut self,
split: &SplitId,
reason: &str,
) -> Result<(), CoordinationError>
fn fail( &mut self, split: &SplitId, reason: &str, ) -> Result<(), CoordinationError>
Report an owned split as unprocessable by this tenancy: consumes
one delivery attempt and releases it for another worker to retry.
At the backend’s attempt cap the split is quarantined instead
(
CoordinationEvent::Quarantined). Use for poison input; a
transient local problem is better handled by
release, which consumes nothing.Source§fn release(&mut self, splits: &[SplitId]) -> Result<(), CoordinationError>
fn release(&mut self, splits: &[SplitId]) -> Result<(), CoordinationError>
Voluntarily hand back owned splits (shutdown, scale-down) so peers
claim them without waiting out a lease. Consumes no delivery
attempts. Best-effort and idempotent; splits not released simply
expire.
Source§fn release_drained(
&mut self,
splits: &[SplitId],
) -> Result<(), CoordinationError>
fn release_drained( &mut self, splits: &[SplitId], ) -> Result<(), CoordinationError>
Release splits given up through a cooperative revocation — the owner
has drained each split, committed its tail, and is now handing it
back. Semantically a
release
(attempt-free, best-effort, idempotent), but distinguished so a
revocation-aware backend can record the drain as having completed
and never mistake a single-split revocation for a departure from the
fleet. Read moreSource§fn decline_revoke(&mut self, split: &SplitId) -> Result<(), CoordinationError>
fn decline_revoke(&mut self, split: &SplitId) -> Result<(), CoordinationError>
Decline a
RevokeRequested
the embedder cannot serve — the source refused to stop the split’s
intake, or the split is not in a drainable state. Read moreAuto Trait Implementations§
impl<S> !RefUnwindSafe for StoreCoordinator<S>
impl<S> !Sync for StoreCoordinator<S>
impl<S> !UnwindSafe for StoreCoordinator<S>
impl<S> Freeze for StoreCoordinator<S>where
S: Freeze,
impl<S> Send for StoreCoordinator<S>
impl<S> Unpin for StoreCoordinator<S>where
S: Unpin,
impl<S> UnsafeUnpin for StoreCoordinator<S>where
S: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more