/** * Index Storage Port * * Abstract interface for storing and retrieving index data. * This allows the domain to remain independent of the actual storage implementation. */ import type { FileIndex, ModuleManifest, GlobalManifest, Config } from '../entities'; import type { Tier1Manifest } from '../entities'; /** * Abstract index storage interface. * * Handles persistence of index data (Tier 1 and Tier 2). * Implementations might use: * - Filesystem (current) * - SQLite * - IndexedDB (for browser) */ export interface IndexStorage { /** * Load configuration from storage */ loadConfig(): Promise; /** * Save configuration to storage */ saveConfig(config: Config): Promise; /** * Load global manifest */ loadGlobalManifest(): Promise; /** * Save global manifest */ saveGlobalManifest(manifest: GlobalManifest): Promise; /** * Load module manifest */ loadModuleManifest(moduleId: string): Promise; /** * Save module manifest */ saveModuleManifest(moduleId: string, manifest: ModuleManifest): Promise; /** * Load Tier 1 index for a module */ loadTier1Index(moduleId: string): Promise; /** * Save Tier 1 index for a module */ saveTier1Index(moduleId: string, manifest: Tier1Manifest): Promise; /** * Load file index (Tier 2) */ loadFileIndex(moduleId: string, filepath: string): Promise; /** * Save file index (Tier 2) */ saveFileIndex(moduleId: string, filepath: string, index: FileIndex): Promise; /** * Delete file index */ deleteFileIndex(moduleId: string, filepath: string): Promise; /** * List all indexed files for a module */ listIndexedFiles(moduleId: string): Promise; /** * Check if index exists for this project */ indexExists(): Promise; /** * Delete entire index */ deleteIndex(): Promise; /** * Get the root directory being indexed */ getRootDir(): string; }