multistore-metering
Usage metering and quota enforcement middleware for the multistore S3 proxy gateway.
Overview
Provides a Middleware implementation that hooks into the proxy dispatch pipeline to enforce quotas before requests proceed and record usage after responses complete. Integrators supply their own storage backends by implementing two traits:
QuotaChecker— called pre-dispatch; returnErr(QuotaExceeded)to reject with HTTP 429UsageRecorder— called post-dispatch with aUsageEvent(identity, operation, bytes, status)
Usage
use ;
// With both:
let metering = new;
// Or selectively:
let quota_only = new;
let record_only = new;
let gateway = gateway.with_middleware;