/** * Schema-Free Storage Architecture * * Manages dynamic schema evolution and automatic indexing * Compatible with MongoDB's flexible document model */ import { CollectionAnalytics, IndexSpec, IIndexManager } from './interface.js'; /** * Dynamic Index Manager * Handles automatic field indexing based on query patterns */ export declare class DynamicIndexManager implements IIndexManager { private d1; private kvStore?; private fieldMappings; private queryPatterns; private indexColumns; private readonly maxIndexedFields; private readonly autoIndexThreshold; private readonly indexAnalysisInterval; constructor(d1: any, options?: { maxIndexedFields?: number; autoIndexThreshold?: number; indexAnalysisInterval?: number; kvStore?: any; }); /** * Initialize the schema management system */ initialize(): Promise; /** * Ensure field is indexed if query patterns warrant it */ ensureFieldIndex(collection: string, fieldPath: string, value: any): Promise; /** * Get available index column for new field */ getAvailableIndexColumn(collection: string): Promise; /** * Register field mapping in both memory and persistent storage */ registerFieldMapping(collection: string, fieldPath: string, indexColumn: string, dataType: string): Promise; /** * Get field mapping */ getFieldMapping(collection: string, fieldPath: string): Promise<{ indexColumn: string; dataType: string; } | null>; /** * Analyze query patterns to recommend indexes */ analyzeQueryPatterns(collection: string): Promise; /** * Backfill index for existing documents */ backfillIndex(collection: string, fieldPath: string, indexColumn: string): Promise; /** * Record query pattern for analysis */ recordQueryPattern(collection: string, field: string, operator: string, selectivity?: number): Promise; /** * Get collection analytics */ getCollectionAnalytics(collection: string): Promise; /** * Migrate field type/structure */ migrateField(collection: string, fieldPath: string, transform: (value: any) => any, options?: { dryRun?: boolean; batchSize?: number; }): Promise; /** * Initialize available index columns */ private initializeIndexColumns; /** * Create system tables for schema management */ private createSystemTables; /** * Load existing field mappings from database */ private loadExistingMappings; /** * Analyze existing data for optimization opportunities */ private analyzeExistingData; /** * Determine if field should be indexed based on usage patterns */ private shouldCreateIndex; /** * Create dynamic index for field */ private createDynamicIndex; /** * Analyze and optimize indexes periodically */ private analyzeAndOptimizeIndexes; /** * Get active collections */ private getActiveCollections; /** * Clean up unused indexes */ private cleanupUnusedIndexes; /** * Persist query patterns to database */ private persistQueryPatterns; /** * Analyze fields in collection */ private analyzeCollectionFields; /** * Recursively analyze document fields */ private analyzeDocumentFields; /** * Generate index recommendation for field */ private generateIndexRecommendation; /** * Get index usage statistics */ private getIndexUsageStats; /** * Get query pattern statistics */ private getQueryPatternStats; /** * Generate optimization recommendations */ private generateOptimizationRecommendations; /** * Log schema evolution event */ private logSchemaEvolution; /** * Utility methods */ private extractFieldValue; private setFieldValue; private inferDataType; private normalizeValueForIndex; } //# sourceMappingURL=schema-manager.d.ts.map