Updates
This commit is contained in:
@@ -1,5 +1,46 @@
|
||||
# Architecture: hyper-p2p-sla-budget
|
||||
|
||||
**Category:** measurement-rate-control
|
||||
**Category:** measurement-rate-control
|
||||
**Protocol:** `sla-budget/v1` (local-only)
|
||||
|
||||
`_services: Map<service, { remaining, total }>`. Allocate adds tokens; consume subtracts or rejects. Emits `allocate`, `consume`, `reject`. No P2P layer.
|
||||
## Purpose
|
||||
|
||||
Token-bucket style SLA budgets per named service.
|
||||
|
||||
## Wire messages
|
||||
|
||||
| type | fields | behavior |
|
||||
|------|--------|----------|
|
||||
| — | — | Local accounting only |
|
||||
|
||||
## Service record
|
||||
|
||||
```
|
||||
{ remaining: number, total: number }
|
||||
```
|
||||
|
||||
## consume decision
|
||||
|
||||
```
|
||||
if !service or remaining < n → reject + emit reject
|
||||
else remaining -= n → consume + emit consume
|
||||
```
|
||||
|
||||
## Stats
|
||||
|
||||
| Field | Meaning |
|
||||
|-------|---------|
|
||||
| `allocated` | `allocate` calls |
|
||||
| `consumed` | successful `consume` |
|
||||
| `rejected` | denied `consume` |
|
||||
|
||||
## Composition
|
||||
|
||||
- Drive `consume` from middleware after `hyper-p2p-percentile-sketch` detects p99 regression
|
||||
- Reset budgets on epoch boundaries in app cron
|
||||
- Distinct from `hyper-p2p-bucket-rate-limit` (time-window rate) — this is cumulative budget
|
||||
|
||||
## Limits
|
||||
|
||||
- No automatic refill (call `allocate` for top-ups)
|
||||
- No cross-peer sync
|
||||
|
||||
Reference in New Issue
Block a user