/** * Content-addressed store for attachment bytes. * * Attachment content is immutable for a given (UIDVALIDITY, UID, part) — IMAP * guarantees it — so it is addressed by the SHA-256 of its bytes rather than * by message coordinates. Three properties fall out of that: * * - **Dedup is free.** The same PDF forwarded across threads and accounts is * stored once. * - **Reads are verified.** Every read re-hashes; corrupted or tampered * content is removed and reported as a miss rather than handed to a caller. * This is why writes need no fsync discipline — a torn file cannot match * its own name, so it is unreachable garbage the next read cleans up. * - **Writes are atomic.** Content lands in a temp file in its final * directory, created 0600, then renamed into place. * * Paths shard on the first two hex characters of the digest, the layout git * and npm's cacache both use, to keep directory entry counts bounded. * * The index that maps messages to digests lives in SQLite (`attachment` * table); this class knows nothing about mail. Everything here is safe to * delete at any time, per the XDG cache contract. */ export interface StoredBlob { sha256: string; size: number; } export default class BlobStore { private readonly root; constructor(root: string); private static digest; /** `/ab/abcdef…` — sharded to bound directory size. */ private pathFor; /** * Store content, returning its address. Writing content that is already * held is a no-op beyond the hash. */ put(content: Buffer): Promise; /** * Read content back, verifying it against its address. * * @returns the bytes, or undefined when absent or corrupt. */ get(sha256: string): Promise; /** Remove content. Absent content is not an error. */ delete(sha256: string): Promise; /** Every digest currently held, for orphan reconciliation against the index. */ list(): string[]; /** Total bytes held, counted toward the shared cache budget. */ sizeBytes(): number; } //# sourceMappingURL=blob-store.d.ts.map