/** * Content-Addressed Block Store * * IPFS-inspired content-addressed storage for Society Protocol. * Uses blake3 hashing for CIDs and SQLite for block persistence. * Supports chunked file storage with Merkle-like manifests. * * Based on: IPFS (arXiv:1407.3561) — content-addressed blocks with CID-based retrieval */ import { type Storage } from './storage.js'; export interface FileManifest { rootCid: string; fileName: string; totalSize: number; blockSize: number; blocks: Array<{ cid: string; offset: number; size: number; }>; mimeType?: string; createdAt: number; author: string; } export declare class ContentStore { private storage; private manifests; constructor(storage: Storage); private ensureTable; /** * Store a data block, returning its CID (blake3 hash). */ put(data: Uint8Array): Promise; /** * Retrieve a block by CID. */ get(cid: string): Promise; /** * Check if a block exists locally. */ has(cid: string): boolean; /** * Store a file from disk, chunking into blocks. * Returns a manifest describing all blocks. */ storeFile(filePath: string, author: string): Promise; /** * Store raw buffer data, chunking into blocks. */ storeBuffer(data: Buffer | Uint8Array, fileName: string, author: string): Promise; /** * Reassemble a file from its manifest. * All blocks must be locally available. */ retrieveFile(manifest: FileManifest): Promise; /** * Save reassembled file to disk. */ saveFile(manifest: FileManifest, outputPath: string): Promise; /** * Get a manifest by root CID. */ getManifest(rootCid: string): FileManifest | null; /** * List all stored file manifests. */ listFiles(): FileManifest[]; /** * List missing blocks for a manifest (for fetching from peers). */ getMissingBlocks(manifest: FileManifest): string[]; /** * Store a manifest received from a peer (without blocks). */ addRemoteManifest(manifest: FileManifest): void; } //# sourceMappingURL=content-store.d.ts.map