Skip to content

Commit 556791a

Browse files
committed
docs: tighten quota enforcement comments
1 parent c8c96f4 commit 556791a

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

api/src/quota_cache.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ use aruna_operations::get_realm_config::GetRealmConfigOperation;
66
use tokio::sync::RwLock;
77

88
/// Short TTL for the realm-config read-through cache on the quota write path.
9-
/// Every PUT/CMU/staging write resolves the group ceiling and the active node
10-
/// set from the realm config; without a cache each drives a fresh
11-
/// `GetRealmConfigOperation`. Enforcement lag after a quota change is bounded by
12-
/// this TTL, well inside the snapshot-staleness budget the grace headroom covers.
9+
/// Enforcement lag after a quota change is bounded by this, inside the
10+
/// snapshot-staleness budget the grace headroom covers.
1311
pub const QUOTA_CONFIG_CACHE_TTL: Duration = Duration::from_secs(2);
1412

1513
/// Read-through cache of the realm config for the quota write path.

operations/src/usage_stats.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,13 @@ pub enum QuotaGateError {
195195
UnexpectedEvent(Event),
196196
}
197197

198-
/// Embeddable read side of the hard per-group quota gate. Sums the group's
199-
/// realm-wide `logical_bytes` — the live local group counter plus every trusted
200-
/// remote node's replicated group snapshot. The local group counter is read
201-
/// inside the caller's write transaction so a concurrent same-group write
202-
/// conflicts on the group counter key (via `UsageCounterUpdate`) and cannot slip
203-
/// a second write past the ceiling. The remote-snapshot scan runs *outside* the
204-
/// transaction (`txn_id: None`) so hot writes no longer read-conflict with
205-
/// concurrent snapshot ingest; remote group totals already lag the counters that
206-
/// produced them, and `ceiling`'s folded-in grace factor is deliberately the
207-
/// budget for that staleness.
208-
///
209-
/// `active_node_ids` is the set of nodes whose per-group snapshots count toward
210-
/// the sum, resolved from the realm config at the request surface. `None` counts
211-
/// every replicated snapshot.
198+
/// Embeddable read side of the hard per-group quota gate: the local group counter
199+
/// plus every trusted remote snapshot. The local counter is read inside the
200+
/// caller's write transaction so a concurrent same-group write conflicts on it and
201+
/// cannot slip past the ceiling; the remote-snapshot scan runs outside the
202+
/// transaction (`txn_id: None`) so hot writes no longer conflict with snapshot
203+
/// ingest, and `ceiling`'s grace factor is the budget for that staleness.
204+
/// `active_node_ids` are the nodes whose snapshots count; `None` counts all.
212205
#[derive(Clone, Debug, PartialEq)]
213206
pub struct QuotaGate {
214207
ceiling: u64,

0 commit comments

Comments
 (0)