pub trait PlacementSignals {
// Required methods
fn member_capacity(&self, member: &NodeIdentity) -> MemberCapacity;
fn range_load(
&self,
collection: &CollectionId,
range_id: RangeId,
) -> RangeLoad;
// Provided method
fn member_attribute(
&self,
_member: &NodeIdentity,
_key: &str,
) -> Option<&str> { ... }
}Expand description
The live cluster state the planner reads but does not own: each member’s advertised capacity and each range’s bytes/traffic.
Production backs this onto the disk-usage reporter and the per-range traffic counters; tests back it onto a scripted fake. Keeping it behind a trait is what makes the planner a pure policy.
Required Methods§
Sourcefn member_capacity(&self, member: &NodeIdentity) -> MemberCapacity
fn member_capacity(&self, member: &NodeIdentity) -> MemberCapacity
The capacity member currently advertises. A member that advertises
nothing (or is unknown) should report a zero-disk MemberCapacity, which
makes it un-placeable rather than a div-by-zero hazard.
Sourcefn range_load(&self, collection: &CollectionId, range_id: RangeId) -> RangeLoad
fn range_load(&self, collection: &CollectionId, range_id: RangeId) -> RangeLoad
The current load on (collection, range_id) — its bytes and its recent
read/write traffic.
Provided Methods§
Sourcefn member_attribute(&self, _member: &NodeIdentity, _key: &str) -> Option<&str>
fn member_attribute(&self, _member: &NodeIdentity, _key: &str) -> Option<&str>
Placement attribute advertised by member, such as a zone or region.
Implementations that do not track topology attributes can leave this
absent; spread rules then degrade through operator warnings instead of
inventing topology.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".