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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
use Future;
use Duration;
use Cow;
use Bytes;
use ProximaError;
// ── payload capability traits ─────────────────────────────────────────────────
//
// These traits express what a payload must provide to generic middleware
// skeletons. The skeletons (Retry, etc.) are generic over the inner pipe;
// these traits are the injected seams. HTTP implements them on
// Request/Response in proxima-pipe (orphan rule). Non-HTTP payloads implement
// them in their own crate.
//
// A pass/reject decision is NOT one of these seams: `In -> Result<In, Err>`
// is a pipe (`Ok` = admit, `Err` = reject), composed via `and_then` — not a
// `decide(&In) -> bool` capability with companions to carry the item and the
// rejection back (see `pipe/fan_in.rs`'s `FanInStrategy` doc for the pipe-vs-
// strategy line this used to violate).
/// An input that can be re-fed to the inner pipe for each retry attempt. HTTP
/// forks the body stream through a `Replay` (bounded by `replay_cap_bytes`); a
/// cloneable payload (an event) clones. The skeleton owns neither mechanism.
/// Whether an input is safe to retry (HTTP: idempotent method).
/// Outcome classification for retry (HTTP: status codes). A statusless outcome
/// (a plain event) returns `None` and is governed only by error retry.
/// The monotonic-clock seam the timer-driven executors (`Retry`, and later
/// `Timeout`/`Hedge`) are generic over. `Delay` is an associated future, so the
/// executor holds it inline in its state machine — no boxing, no alloc, no_std.
///
/// Production impls wrap `proxima-time` (`crate::pipe::clock::TimeClock`,
/// whose `Sleep` is a concrete `Delay`); deterministic tests reach for
/// `crate::pipe::clock::testing::{MockClock, RecordingClock}` — the canonical
/// doubles, not a bespoke fake per call site.
///
/// Two other `Clock` traits exist in the workspace, and neither collapses
/// into this one: `prime::core::timer::Clock` is a lower-level,
/// resolution-agnostic tick source (NOT nanosecond-pinned — `TimerWheel`
/// needs no `Delay` and a coarser unit) for the wheel data structure this
/// trait's production `Sleep` is ultimately built over; `proxima_telemetry
/// ::clock::Clock` is nanosecond-pinned like this one but deliberately
/// object-safe (no associated type), because the per-core `Recorder` erases
/// its clock behind `Arc<dyn Clock + Send + Sync>` — a shape this trait's
/// `Delay` associated type cannot support without boxing.
/// A value that can apply a sequence of typed ops to itself.
///
/// Implement this on any input or output type to make Transform work over it.
/// HTTP: `Request<Bytes>: ApplyOps<RequestOp>`, `Response<Bytes>: ApplyOps<ResponseOp>`.
/// A value that exposes a mutable byte buffer for fuzzing.
///
/// Implement this on any payload to make `Mutation` / `MutateOp` work over it.
/// HTTP impls it on `Request` and `Response` (their `body`); a non-HTTP payload
/// implements it over its own bytes.
/// The action taken when a rate-limit bucket is exhausted.
/// Extracts a rate-limit bucket key from an input and constructs the rejection
/// output when the bucket is exhausted.
///
/// Implement this on any input type to make `RateLimit` work over it.
/// HTTP: `Request<Bytes>: KeyOf<KeyExtractor>` with `type Rejection = Response<Bytes>`.
///
/// Additive at the alloc tier: the key is borrowed-or-owned (`Cow<[u8]>`), so
/// this seam needs `alloc`. The rest of the vocabulary is core-tier.
/// Outcome of a check: either admitted (pass through to inner) or rejected
/// (short-circuit with a pre-built output).
/// A value that can check itself against an op and decide pass/reject.
///
/// Implement this on any input type to make Validate work over it.
/// HTTP: `Request<Bytes>: Checkable<ValidateOp>` with `Out = Response<Bytes>`.