pub struct WorkerRegistry { /* private fields */ }Expand description
Connected workers and their leases, shared by all remote pools.
Implementations§
Source§impl WorkerRegistry
impl WorkerRegistry
Sourcepub fn stale_reports(&self) -> u64
pub fn stale_reports(&self) -> u64
Number of reports for leases the reporting worker did not hold, which were ignored.
Sourcepub fn attach(&self, sched: Scheduler<Bytes, Bytes>)
pub fn attach(&self, sched: Scheduler<Bytes, Bytes>)
Start publishing capacity changes to sched.
Sourcepub fn next_worker_id(&self) -> u64
pub fn next_worker_id(&self) -> u64
Reserve a worker id. Send Registered before calling Self::register, so the worker
never receives a lease before its registration ack.
Sourcepub fn register(
&self,
id: u64,
pool: Arc<str>,
labels: Labels,
name: String,
slots: u32,
tx: WorkerTx,
cut: CancellationToken,
) -> bool
pub fn register( &self, id: u64, pool: Arc<str>, labels: Labels, name: String, slots: u32, tx: WorkerTx, cut: CancellationToken, ) -> bool
Add a worker. Returns false if the registry is already closed (shutting down).
Sourcepub fn set_slots(&self, worker: u64, slots: u32)
pub fn set_slots(&self, worker: u64, slots: u32)
Change a worker’s slots (already capped by the caller).
Sourcepub fn unregister(&self, worker: u64)
pub fn unregister(&self, worker: u64)
Remove a worker; its in-flight leases fail as retryable.
Sourcepub fn reject(&self, worker: u64, status: Status)
pub fn reject(&self, worker: u64, status: Status)
Cut a worker’s stream with status (e.g. a protocol violation) and remove it.
Sourcepub fn finish(
&self,
worker: u64,
lease: u64,
result: Result<Bytes, TaskError>,
) -> Option<TaskId>
pub fn finish( &self, worker: u64, lease: u64, result: Result<Bytes, TaskError>, ) -> Option<TaskId>
Resolve a lease reported by worker. Reports for leases the worker does not hold are
ignored.
Sourcepub fn nack(&self, worker: u64, lease: u64, reason: &str)
pub fn nack(&self, worker: u64, lease: u64, reason: &str)
The worker refused a lease: offer it to another worker of the pool. If none can take it, the attempt fails as retryable.
Sourcepub fn abort(&self, lease: u64, reason: &str)
pub fn abort(&self, lease: u64, reason: &str)
Tell the worker to stop an attempt the engine no longer wants, freeing its slot. The Abort is never dropped: a worker that cannot receive it is disconnected.
Sourcepub fn close_all(&self, reason: &str, not_leader: bool, grace: Duration)
pub fn close_all(&self, reason: &str, not_leader: bool, grace: Duration)
Stop accepting workers, tell every worker to go away and drop their streams. Streams that
are not drained within grace are cut.
Sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
Connected workers.
Sourcepub fn list(&self) -> Vec<WorkerSummary>
pub fn list(&self) -> Vec<WorkerSummary>
Connected workers in connection order.
Sourcepub fn pool_worker_count(&self, pool: &str) -> usize
pub fn pool_worker_count(&self, pool: &str) -> usize
Connected workers of pool.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WorkerRegistry
impl RefUnwindSafe for WorkerRegistry
impl Send for WorkerRegistry
impl Sync for WorkerRegistry
impl Unpin for WorkerRegistry
impl UnsafeUnpin for WorkerRegistry
impl UnwindSafe for WorkerRegistry
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request