Skip to main content

AvailabilityAnswer

Struct AvailabilityAnswer 

Source
pub struct AvailabilityAnswer {
    pub available: bool,
    pub roots: Option<Vec<HexId>>,
    pub total_length: Option<u64>,
    pub chunk_count: Option<u64>,
    pub complete: Option<bool>,
    pub providers: Option<Vec<Provider>>,
    pub absence_established: Option<bool>,
}
Expand description

One availability answer. Only the fields relevant to the query’s granularity are populated.

Fields§

§available: bool

Whether this node holds the queried item.

§roots: Option<Vec<HexId>>

The roots held (store-granularity queries only).

§total_length: Option<u64>

The full resource ciphertext length (resource-granularity only).

§chunk_count: Option<u64>

The chunk count (resource-granularity only).

§complete: Option<bool>

Whether the whole item is held (root/resource-granularity only).

§providers: Option<Vec<Provider>>

Providers that hold the item — present on a miss when holders were located (enriched answer).

§absence_established: Option<bool>

Whether this responder actually ESTABLISHED that nobody holds the item.

Only meaningful beside available: false; on a hit the item is held and there is nothing to establish.

§Absent is a THIRD state, not false

  • Some(true) — the responder looked, reached everything it meant to reach, and asserts absence. A client MAY stop searching.
  • Some(false) — the responder looked and could NOT establish absence: a hop timed out, was unreachable, or refused uninformatively. A client MUST keep looking. This is the in-band form of ContentMissInconclusive, for a batch where only SOME items were inconclusive and the call itself therefore succeeded.
  • None — the responder predates this field and makes NO claim either way. It is NOT Some(false): Some(false) is a responder telling you its search was incomplete, while None is a responder that cannot describe its search at all. Conflating them lets an older server every miss be read as a positive report of incompleteness; conflating it the other way (unwrap_or(true)) turns an unknown into an assertion of absence. Read it through absence_established_or_unknown, which keeps the three states distinct.

Implementations§

Source§

impl AvailabilityAnswer

Source

pub fn absence_established_or_unknown(&self) -> Option<bool>

Whether absence was established, as a THREE-state answer: Some(true) asserted, Some(false) explicitly not established, None unknown because the responder predates the field.

A pass-through, and that is the point — it is the named home for the rule that there is no safe collapse to bool. A client that wants to stop searching MUST require Some(true).

Trait Implementations§

Source§

impl Clone for AvailabilityAnswer

Source§

fn clone(&self) -> AvailabilityAnswer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AvailabilityAnswer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AvailabilityAnswer

Source§

fn default() -> AvailabilityAnswer

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AvailabilityAnswer

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for AvailabilityAnswer

Source§

fn eq(&self, other: &AvailabilityAnswer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AvailabilityAnswer

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AvailabilityAnswer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.