pub trait InstanceSelector: Send + Sync {
// Required methods
fn reads_active_requests(&self) -> bool;
fn select_instance(
&self,
instance_ids: &[u64],
active_requests: &dyn Fn(u64) -> u64,
preview: bool,
) -> Option<u64>;
}Expand description
Picks one instance for a PushRouter routing mode.
PushRouter calls select_instance inside its admission lock
when reads_active_requests is true, so it must not block.
Required Methods§
Sourcefn reads_active_requests(&self) -> bool
fn reads_active_requests(&self) -> bool
Whether selection reads in-flight request counts. PushRouter then tracks them and
reserves the chosen instance.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".