Skip to main content

DhtError

Enum DhtError 

Source
#[non_exhaustive]
pub enum DhtError {
Show 15 variants NotFound { agent_uri: String, }, AlreadyRegistered { agent_uri: String, }, Expired { agent_uri: String, }, InvalidAttestation { agent_uri: String, reason: String, }, IdentityCapabilityConflict { identity: String, existing_path: String, requested_path: String, }, KeyCapacityExceeded { key: String, max: usize, }, NoEndpoints, Unauthorized { agent_uri: String, operation: MutationKind, }, AgentKeyMismatch { agent_uri: String, }, Rejected { agent_uri: String, reason: String, }, StaleSequence { agent_uri: String, presented: u64, current: u64, }, Timeout { operation: &'static str, after: Duration, }, QuorumFailed { achieved: usize, required: usize, }, NoPeers, Unavailable { reason: String, },
}
Expand description

Errors that can occur during DHT operations.

#[non_exhaustive], so a match on this enum needs a _ arm. New variants name failures currently reported more coarsely, and adding one should not be a major release.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NotFound

The agent is not registered.

Fields

§agent_uri: String

The agent URI that was not found

§

AlreadyRegistered

The registration already exists.

Fields

§agent_uri: String

The agent URI that was already registered

§

Expired

The registration has expired.

Fields

§agent_uri: String

The agent URI whose registration expired

§

InvalidAttestation

The attestation is invalid or missing.

Fields

§agent_uri: String

The agent URI with invalid attestation

§reason: String

Reason the attestation is invalid

§

IdentityCapabilityConflict

An existing agent identifier was presented under a different capability path.

Fields

§identity: String

Stable trust-root and agent-ID identity key

§existing_path: String

Capability path already bound to the identity

§requested_path: String

New conflicting capability path

§

KeyCapacityExceeded

Too many agents already hold the capability path being registered.

The key named is the one the registration derives from its own path. A crowded ancestor never produces this: an agent is charged for the key it chose, not for the subtree it happens to fall inside.

Fields

§key: String

The DHT key that is at capacity

§max: usize

Maximum allowed registrations

§

NoEndpoints

The endpoints list is empty.

§

Unauthorized

The write presented no valid proof that the agent’s key holder authorized it.

Fields

§agent_uri: String

The agent URI whose record the write targeted

§operation: MutationKind

The operation that was refused

§

AgentKeyMismatch

The attestation names a different agent key than the registration.

Fields

§agent_uri: String

The agent URI whose registration was refused

§

Rejected

A node refused to store the record.

Distinct from the variants that name a specific defect. A distributed backend applies checks the in-process index has no reason to: whether a record’s lifetime is one this node will hold, whether its encoding is one this node speaks. Collapsing those into InvalidAttestation would send an operator looking at trust roots for a clock problem.

Fields

§agent_uri: String

The agent URI whose record was refused

§reason: String

Why the node refused it

§

StaleSequence

The write’s sequence number did not advance past the record’s.

Either the write is a replay of one already applied, or two writers are racing against the same record.

Fields

§agent_uri: String

The agent URI whose record the write targeted

§presented: u64

The sequence number the write presented

§current: u64

The sequence number the record already holds

§

Timeout

The operation did not complete within its deadline.

Fields

§operation: &'static str

The operation that timed out

§after: Duration

How long the operation was given

§

QuorumFailed

Too few replicas answered to satisfy the requested quorum.

Fields

§achieved: usize

Replicas that answered

§required: usize

Replicas the requested quorum needed

§

NoPeers

The node is not connected to any peer that can serve the operation.

§

Unavailable

The local node cannot serve the request at all.

Distinct from DhtError::NoPeers, which describes the overlay. This describes the node the caller is holding: it has shut down, or its own store will not take the record. Retrying against the same handle will fail the same way.

Fields

§reason: String

What is wrong with this node

Implementations§

Source§

impl DhtError

Source

pub fn not_found(agent_uri: impl Into<String>) -> Self

Creates a NotFound error.

Source

pub fn already_registered(agent_uri: impl Into<String>) -> Self

Creates an AlreadyRegistered error.

Source

pub fn expired(agent_uri: impl Into<String>) -> Self

Creates an Expired error.

Source

pub fn invalid_attestation( agent_uri: impl Into<String>, reason: impl Into<String>, ) -> Self

Creates an InvalidAttestation error.

Source

pub fn unavailable(reason: impl Into<String>) -> Self

Creates an Unavailable error.

Source

pub fn rejected(agent_uri: impl Into<String>, reason: impl Into<String>) -> Self

Creates a Rejected error.

Source

pub fn key_capacity_exceeded(key: impl Into<String>, max: usize) -> Self

Creates a KeyCapacityExceeded error.

Source

pub const fn is_not_found(&self) -> bool

Returns true if this error indicates the agent was not found.

Source

pub const fn is_expired(&self) -> bool

Returns true if this error indicates the registration expired.

Source

pub const fn is_transient(&self) -> bool

Returns true if retrying the operation could plausibly succeed.

Transient failures describe the network, not the request: the same call against a healthier overlay may succeed. Every other variant rejects the request itself and will keep rejecting it.

A transient failure is not proof the operation did not take effect. A write that timed out may have reached some replicas, so retries must be safe to repeat.

Trait Implementations§

Source§

impl Clone for DhtError

Source§

fn clone(&self) -> Self

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 DhtError

Source§

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

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

impl Display for DhtError

Source§

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

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

impl Eq for DhtError

Source§

impl Error for DhtError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for DhtError

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DhtError

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> 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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V