/** * QA360 Content-Addressable Storage (CAS) * Stores files by their SHA256 hash with deduplication */ export interface CASArtifact { sha256: string; path: string; size: number; exists: boolean; } export interface CASStats { totalFiles: number; totalBytes: number; orphanedFiles: number; orphanedBytes: number; } export declare class ContentAddressableStorage { private readonly casRoot; constructor(baseDir: string); /** * Save content to CAS, returns artifact metadata */ saveArtifact(content: Buffer, mimeType: string, originalName?: string): Promise; /** * Save file to CAS by path */ saveFile(filePath: string, mimeType: string): Promise; /** * Retrieve content from CAS */ getArtifact(sha256: string): Promise; /** * Check if artifact exists in CAS */ exists(sha256: string): boolean; /** * Get artifact metadata */ getArtifactInfo(sha256: string): Promise<{ size: number; mtime: Date; } | null>; /** * List all artifacts in CAS */ listArtifacts(): Promise; /** * Get CAS statistics */ getStats(referencedHashes?: Set): Promise; /** * Remove orphaned artifacts */ cleanupOrphans(referencedHashes: Set): Promise<{ removedFiles: number; freedBytes: number; }>; /** * Calculate SHA256 hash of content */ calculateHash(content: Buffer): string; /** * Calculate SHA256 hash of content (static utility) */ static hashContent(content: Buffer): string; /** * Get CAS file path for a given hash (with sharding) */ private getCASPath; /** * Ensure CAS directory structure exists */ private ensureCASDirectory; /** * Clean up empty shard directories */ private cleanupEmptyDirectories; /** * Verify artifact integrity */ verifyArtifact(sha256: string): Promise; /** * Copy artifact to external path */ exportArtifact(sha256: string, targetPath: string): Promise; /** * Get human-readable size */ static formatBytes(bytes: number): string; }