/** * Multi-tenant quota enforcement for logosdb-mcp-server. * * All checks are O(1) counter reads — zero hot-path overhead when quotas are * not configured (the default). * * Environment variables: * LOGOSDB_QUOTA_MAX_VECTORS Max live vectors per namespace (0 = unlimited, default 0) * LOGOSDB_QUOTA_MAX_NAMESPACES Max namespaces under DB root (0 = unlimited, default 0) */ export interface QuotaConfig { /** Maximum live vectors per namespace. 0 = unlimited. */ maxVectorsPerNs: number; /** Maximum distinct namespaces under the DB root. 0 = unlimited. */ maxNamespaces: number; } export declare function loadQuotaConfig(): QuotaConfig; /** * Throw if inserting `adding` vectors into `namespace` would exceed the * per-namespace vector limit. No-op when the limit is 0 (unlimited). * * Pass `db.countLive()` as `currentLive` — the call is O(1). */ export declare function checkVectorQuota(currentLive: number, adding: number, namespace: string, cfg: QuotaConfig): void; /** * Throw if creating `newNs` as a brand-new namespace would exceed the * namespace-count limit. No-op when the limit is 0, or when `newNs` is * already present in `existingNs` (opening an existing ns is always allowed). */ export declare function checkNsQuota(existingNs: string[], newNs: string, cfg: QuotaConfig): void; export declare class QuotaExceededError extends Error { readonly kind: 'vectors' | 'namespaces'; readonly namespace: string; constructor(message: string, kind: 'vectors' | 'namespaces', namespace: string); } //# sourceMappingURL=quota.d.ts.map