#[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
NotFound
The agent is not registered.
AlreadyRegistered
The registration already exists.
Expired
The registration has expired.
InvalidAttestation
The attestation is invalid or missing.
Fields
IdentityCapabilityConflict
An existing agent identifier was presented under a different capability path.
Fields
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.
NoEndpoints
The endpoints list is empty.
The write presented no valid proof that the agent’s key holder authorized it.
Fields
The agent URI whose record the write targeted
The operation that was refused
AgentKeyMismatch
The attestation names a different agent key than the registration.
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
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
Timeout
The operation did not complete within its deadline.
Fields
QuorumFailed
Too few replicas answered to satisfy the requested quorum.
NoPeers
The node is not connected to any peer that can serve the operation.
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.
Implementations§
Source§impl DhtError
impl DhtError
Sourcepub fn already_registered(agent_uri: impl Into<String>) -> Self
pub fn already_registered(agent_uri: impl Into<String>) -> Self
Creates an AlreadyRegistered error.
Sourcepub fn invalid_attestation(
agent_uri: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_attestation( agent_uri: impl Into<String>, reason: impl Into<String>, ) -> Self
Creates an InvalidAttestation error.
Creates an Unavailable error.
Sourcepub fn rejected(agent_uri: impl Into<String>, reason: impl Into<String>) -> Self
pub fn rejected(agent_uri: impl Into<String>, reason: impl Into<String>) -> Self
Creates a Rejected error.
Sourcepub fn key_capacity_exceeded(key: impl Into<String>, max: usize) -> Self
pub fn key_capacity_exceeded(key: impl Into<String>, max: usize) -> Self
Creates a KeyCapacityExceeded error.
Sourcepub const fn is_not_found(&self) -> bool
pub const fn is_not_found(&self) -> bool
Returns true if this error indicates the agent was not found.
Sourcepub const fn is_expired(&self) -> bool
pub const fn is_expired(&self) -> bool
Returns true if this error indicates the registration expired.
Sourcepub const fn is_transient(&self) -> bool
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§
impl Eq for DhtError
Source§impl Error for DhtError
impl Error for DhtError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()