pub struct StakeLanePolicy { /* private fields */ }Expand description
Stake-lane probe-acceptance policy (#757, ADR 003 §Admission and Priority). Reserves probe-hold headroom for stake-lane requesters — registered operators issuing node-to-node cache-miss probes — so end-client probe load cannot starve them under hold-budget pressure.
“Stake lane” is the CapacityBond.isActive predicate (registered + bond
≥ minBond + not unbonding + not ejected), resolved from the same
chain-followed StakerSet the DHT handler consumes — no per-probe
chain read and no new chain wiring (the issue’s constraint). It is a
faithful binary reading of ADR 003’s bondOf >= bond_required(...)
prioritization; finer capacity-scaled bond tiering is out of scope.
Construction is gated by the operator: the runtime only builds this when
cache.stake_lane_reserved_holds > 0, so a single-lane deployment passes
None and the handler skips the stake-lane check entirely.
Implementations§
Source§impl StakeLanePolicy
impl StakeLanePolicy
Sourcepub fn new(
staker_set: Arc<dyn StakerSet>,
reserved_holds: NonZeroUsize,
max_holds: usize,
) -> Self
pub fn new( staker_set: Arc<dyn StakerSet>, reserved_holds: NonZeroUsize, max_holds: usize, ) -> Self
Build a policy. reserved_holds is NonZeroUsize so the “off” case
(a zero reservation) cannot be constructed — callers encode it as
None. max_holds is the configured max_probe_holds.
Trait Implementations§
Source§impl Clone for StakeLanePolicy
impl Clone for StakeLanePolicy
Auto Trait Implementations§
impl !RefUnwindSafe for StakeLanePolicy
impl !UnwindSafe for StakeLanePolicy
impl Freeze for StakeLanePolicy
impl Send for StakeLanePolicy
impl Sync for StakeLanePolicy
impl Unpin for StakeLanePolicy
impl UnsafeUnpin for StakeLanePolicy
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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