pub struct Candidate {
pub node_id: [u8; 32],
pub rate_per_mb: u64,
pub rtt_ms: u32,
pub reputation: f32,
pub region: String,
pub stake: u64,
pub coverage: Coverage,
pub total_bytes_hint: Option<u64>,
}Expand description
A candidate provider produced by content discovery, ready to be ranked.
Fields§
§node_id: [u8; 32]Iroh NodeId (Ed25519 public key) of the candidate.
rate_per_mb: u64Quoted price in token base units per MB, from the most recent
ProbeResponse (decdn_protocol::message::ProbeResponse::rate_per_mb).
rtt_ms: u32Round-trip latency observed during probing.
reputation: f32Local reputation in [0.0, 1.0] from the reputation engine.
region: StringISO 3166-1 alpha-2 region self-attested by the peer on-chain (ADR 030),
resolved from the CapacityBond registry projection. Used by the
geo-diversity tie-break tier.
stake: u64On-chain stake in TOKEN base units; higher stake wins the stake
tie-break tier. 0 means known to hold no bond — there is no
“not looked up” state, by design (#1470).
This type has no encoding for a failed read — not the same as
preventing one. A chain read succeeds for some peers and fails for
others, and a mixed population is the steady state for an RPC read, not
an edge case; folding a failure to 0 here would silently sink a
well-staked peer below a provably-unbonded one. So the lookup layer must
resolve the failure where it is still visible: retry it, or drop the
candidate. Nothing in the type enforces that today — a future caller
can still write stake: 0 on a failed read and it will compile. The
constructor-level enforcement (a Stake obtainable only from a
successful read, with Candidate’s fields made private) lands with the
lookup itself; see #1470. Nothing populates this yet — on-chain
integration is deferred; see ADR 019 for the capacity-bond interface
that will.
coverage: CoverageWhich discovery blocks (decdn_protocol::coverage) this candidate is
confirmed to hold, per its fresh ProbeResponseExt.coverage (#1506).
This is the PROBE-confirmed value, never the stale DHT-lookup hint —
discovery’s ranking and selection consume only what a live probe just
verified. Ranking itself ignores this field; it rides alongside the
rank/RTT/rate fields for a range-aware caller to read after selection.
total_bytes_hint: Option<u64>The blob size the candidate reported on that probe
(ProbeResponseExt.total_bytes), when it knows it. UNSIGNED: a sizing
hint, never a commitment. The pull leg cuts its first upstream open from
it. When that open runs past the blob’s end, the pull leg opens the whole
blob instead; when the signed size differs from the hint, it drops the
pull.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Candidate
impl RefUnwindSafe for Candidate
impl Send for Candidate
impl Sync for Candidate
impl Unpin for Candidate
impl UnsafeUnpin for Candidate
impl UnwindSafe for Candidate
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