pub trait RegionStatAwareSelector: Send + Sync {
type Context;
type Output;
// Required method
fn select<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 Self::Context,
from_peer_id: u64,
region_ids: &'life2 [RegionId],
exclude_peer_ids: HashSet<u64>,
exclude_peer_ids_by_region: &'life3 HashMap<RegionId, BTreeSet<u64>>,
affinity: Option<&'life4 AffinityRequirements>,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
}Expand description
A selector that aware of region statistics
It selects the best destination peer for a list of regions. The selection is based on the region statistics, such as the region leader’s write throughput.
A region is never placed on exclude_peer_ids, nor on its own peers in
exclude_peer_ids_by_region. It returns the regions it placed, possibly none: a region
without a remaining candidate is left out. Errors are for other failures.
Required Associated Types§
Required Methods§
fn select<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 Self::Context,
from_peer_id: u64,
region_ids: &'life2 [RegionId],
exclude_peer_ids: HashSet<u64>,
exclude_peer_ids_by_region: &'life3 HashMap<RegionId, BTreeSet<u64>>,
affinity: Option<&'life4 AffinityRequirements>,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".