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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Transport-level control types shared between the server runtime and
//! the application-specific protocol crate. These are domain-free:
//! they exist for connection management, auth handshakes, and pipeline
//! control — not for business messages.
/// Connection identifier assigned by the server.
///
/// `u64` — monotonically increasing, never reused within a server
/// lifetime. Fits in a register and supports more connections than any
/// single server will ever handle.
;
/// A request's identifier, chosen by the client that sent it.
///
/// A transport correlation token: the node echoes it on the request's
/// final reply frame and keeps no state about it, so it is never checked
/// for uniqueness or order, and `0` is as valid as any other value. It
/// means nothing outside its connection's lifetime, and is never
/// journaled, replicated, or handed to the application.
///
/// A newtype so it cannot be swapped with the connection ID it travels
/// beside. `u64` so a connection that lives for months at millions of
/// requests a second never has to ask what happens when it wraps.
;
/// The longest refusal reason a `Refused` frame carries, in bytes: its
/// length goes on the wire as one byte.
pub const MAX_REFUSAL_REASON: usize = u8MAX as usize;
/// Why the application's decoder refused a request, as a `Refused` frame
/// says.
///
/// `#[repr(u8)]`, its discriminant the byte on the wire. `0` is no kind,
/// so a zeroed byte is an error, not a refusal.
/// Transport-level response frames that the server runtime encodes
/// directly, bypassing the application's `ResponseEncoder` trait.
///
/// These are the pipeline-control and auth-handshake messages that
/// every server sends regardless of the application it hosts.
///
/// Every frame that ends a request's reply names the request: the batch
/// terminators, `ServerBusy` and `Refused` carry its [`RequestId`].
/// Auth handshake: client → server response to a [`TransportResponse::Challenge`].
///
/// Contains the Ed25519 signature over the nonce and the client's
/// public key for lookup in the authorized-keys table.