/** * Keeps the local mirror inside its byte budget, and keeps the blob store and * its index from drifting apart. * * Eviction order is cheapest-to-rebuild-last. Envelopes are small and are what * every listing needs, so they go last; attachment bytes are the heaviest and * the easiest to re-download, so they go first: * * 1. attachment blobs, least-recently-read first * 2. message bodies, least-recently-read first (envelopes stay) * 3. envelopes older than the configured window — last resort only * * Everything here is best-effort and safe to interrupt: the mirror is * regenerable, so a partial pass just means the next one finishes the job. */ import type BlobStore from './blob-store.js'; import type CacheStore from './store.js'; export interface BudgetResult { /** Bytes held (SQLite + blobs) before the pass. */ usedBytesBefore: number; /** Bytes held after it. */ usedBytesAfter: number; budgetBytes: number; evictedBlobs: number; evictedBodies: number; evictedMessages: number; } interface BudgetOptions { /** * Fraction of the budget to evict down to, so a cache sitting exactly at * the limit does not evict on every single cycle. */ lowWaterRatio?: number; /** Envelopes older than this are evictable in the last-resort step. */ windowDays?: number; } /** * Evict until the mirror is back under the low-water mark. * * @param maxSizeMb the configured budget; 0 disables enforcement entirely. */ export declare function enforceBudget(store: CacheStore, blobs: BlobStore, maxSizeMb: number, options?: BudgetOptions): Promise; /** * Reconcile the blob store against its index in both directions: content no * row references is deleted, and rows whose content has vanished are dropped * so the next read re-downloads instead of failing. * * @returns how many orphaned blobs were removed. */ export declare function collectOrphans(store: CacheStore, blobs: BlobStore): Promise; export {}; //# sourceMappingURL=maintenance.d.ts.map