T-HUB/packages/egress/src/budget.d.ts
glass beadian aa5e262f3a Tactical Media Broadcast Hub — initial release
Self-hosted multi-platform broadcast newsroom for activist collectives:
publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style
column wall with hostile-content-safe rendering, live control room with Auto
Director, bridged chat governance with polls and quorum, distributed sandboxed
transcode workers, encrypted content-addressed archive, monthly analytics.

MIT licensed. See README.md and docs/.
2026-10-10 11:56:42 +00:00

23 lines
991 B
TypeScript

import type { Pool } from "pg";
export declare const REFILL_INTERVAL_MS = 10000;
export interface HostBudget {
capacity: number;
refillPerInterval: number;
}
export declare const DEFAULT_HOST_BUDGET: Readonly<HostBudget>;
export interface HostBudgetOptions {
pool: Pick<Pool, "connect">;
hostClasses?: Readonly<Record<string, HostBudget>>;
/** Test clock only. Production uses the DB clock sampled after acquiring the row lock. */
now?: () => Date;
}
export declare function retryAfterDeadline(headers: Headers, now: number): number | undefined;
export declare class HostBudgets {
private readonly options;
constructor(options: HostBudgetOptions);
private configuration;
private locked;
consume(host: string, hostClass: string): Promise<void>;
/** Header hints can only tighten a shared budget; parking is monotone under concurrent responses. */
observe(host: string, hostClass: string, status: number, headers: Headers): Promise<void>;
}