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
//! PURE metering math (unit-tested without Postgres) and the wall-clock time
//! source: window boundaries, the quota decision, the revision bump, and the
//! closed-rollup bucket.
/// Inclusive lower bound (unix seconds) of a rolling window ending at `now`.
/// Saturating and floored at 0 so a giant window never underflows.
pub
/// The window membership predicate the SQL filter mirrors: an event at exactly
/// the window start is INCLUDED (inclusive lower bound, `>=`). The aggregate
/// filter uses `Ge` on the same boundary so this pure predicate is the single
/// definition of the boundary semantics. Used by the boundary unit test; the
/// runtime path expresses the same `>=` as a SQL filter.
pub
/// The pure quota decision: a rule allows the request iff `used < limit`, and the
/// remaining headroom is `max(0, limit - used)`. Deterministic, no I/O — shared
/// with the test fixtures. (A `limit == 0` rule denies all; a negative limit is
/// rejected at PutQuota and never reaches here.)
pub
/// Monotone per-row revision bump (saturating; never wraps/panics).
pub
/// Wall-clock unix seconds (used only when the caller passes a non-positive ts).
pub
/// Public monotone-seconds source the leader can pass to `record_usage` from the
/// admission hook (kept here so the call site has a single obvious time source).
pub
pub