Files
modules/measurement-rate-control/hyper-p2p-sla-budget/README.md
T
2026-05-20 22:56:32 -04:00

37 lines
670 B
Markdown

# hyper-p2p-sla-budget
Per-service token budgets for SLA-aware rate limiting.
**Category:** measurement-rate-control
**Protocol:** `sla-budget/v1`
## When to use
Allocating and consuming request tokens per API or tenant service name.
## When not to use
Time-windowed rate limits with automatic refill (pair with a scheduler module).
## Quick start
```js
const { HyperP2PSlaBudget } = require('hyper-p2p-sla-budget')
const b = new HyperP2PSlaBudget()
b.allocate('api', 100)
b.consume('api', 1)
console.log(b.remaining('api'))
```
## Docs
- [docs/api.md](docs/api.md)
- [docs/architecture.md](docs/architecture.md)
## Test
```bash
npm install && npm test
```