1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Named failures that never retain request words or credentials.
/// Why an agent operation did nothing, or why its durable outcome is unknown.
#[derive(Debug, thiserror::Error)]
pub enum AgentError {
/// A deliberate act is still a draft in Lys.
#[error("{action} is deliberate: held by draft {draft}")]
Held {
/// The requested action.
action: String,
/// The retained draft id.
draft: String,
},
/// A boundary value is malformed; only the member is named.
#[error("agent_invalid: {0}")]
Invalid(&'static str),
/// A name has no retained record.
#[error("unknown_agent: {0}")]
Unknown(String),
/// A retained name cannot be reused, including after retirement.
#[error("agent_name_taken: {0}")]
NameTaken(String),
/// An identity claim does not match the verified pass.
#[error("pass holder {holder} is not agent {agent}")]
Identity {
/// The verified holder, or unverified.
holder: String,
/// The claimed agent.
agent: String,
},
/// Another live connection holds this agent's seat. It is never taken
/// over or shared: the seat is released when that connection closes, or
/// when its peer stops answering the kernel's keepalive.
#[error(
"agent {agent} is already present on connection {connection}, held since unix ms \
{since_ms}; the seat frees when that connection closes or its peer stops answering \
keepalive (80 s), so give this client a seat of its own"
)]
Present {
/// The agent's name.
agent: String,
/// The incumbent connection.
connection: u64,
/// Epoch milliseconds the incumbent was admitted.
since_ms: u64,
},
/// A configured count or byte bound is reached.
#[error("auth.lys.agents.{bound}: limit {limit}, count {count}")]
Bound {
/// The configuration member.
bound: &'static str,
/// The configured limit.
limit: usize,
/// The measured population or byte count.
count: usize,
},
/// The state machine does not admit this event.
#[error("agent_transition_refused: {0}")]
Transition(&'static str),
/// A draft id is already bound to different immutable words.
#[error("agent_draft_digest_mismatch")]
DraftMismatch,
/// Only the server writes presence and state.
#[error("agent_subject_server_owned: {0}")]
ServerOwned(String),
/// A lock or store failed; request bodies are never included.
#[error("agent_registry_unavailable: {0}")]
Store(String),
/// A write may have committed; reopen before making another decision.
#[error("agent_registry_outcome_unknown: reopen the store before admission")]
Uncertain,
/// The library refused delivery, with no body retained in the error.
#[error("agent_delivery_failed: {0}")]
Delivery(&'static str),
}