/** * Index Types and Interfaces * * Defines the contract for different index types and query strategies. */ export type IndexType = 'hash' | 'sorted' | 'compound' | 'text'; export interface IndexConfig { /** Unique name for this index */ name: string; /** Type of index (hash, sorted, compound, text) */ type: IndexType; /** For single-field indexes: the field name */ field?: string; /** Sort direction for a single-field sorted index. Defaults to ascending. */ direction?: 'asc' | 'desc'; /** For compound indexes: ordered field names. */ fields?: string[]; /** Back-compatible directions for string-valued compound `fields`. */ directions?: Array<'asc' | 'desc'>; /** For text indexes: fields to search */ textFields?: string[]; /** Whether to maintain the index in-memory */ inmemory?: boolean; /** Whether to persist this index to storage */ persistent?: boolean; /** Optional description */ description?: string; } export interface IndexEntry { key: K; values: V[]; count: number; } export interface IndexQuery { field: string; operator: 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'startsWith' | 'range'; value?: any; values?: any[]; min?: any; max?: any; } /** * How a `Collection.find` call was answered. * * Distinct from `QueryPlan`, which describes the cost-based planner's output. * This records what a single collection read actually did. */ export interface CollectionQueryPlan { strategy: 'index' | 'scan'; /** Present when the index was used. */ indexName?: string; field?: string; /** Present when a scan was chosen, explaining why. */ reason?: string; /** Records the predicate was applied to. */ candidatesExamined: number; recordsReturned: number; } export interface IndexScanPlan { indexName: string; indexType: IndexType; estimatedRows: number; cost: number; canPruneAll: boolean; requiresPostFilter: boolean; } export interface QueryPlan { strategy: 'full-scan' | 'index-scan' | 'index-merge' | 'index-join'; indexes: IndexScanPlan[]; estimatedRows: number; totalCost: number; explanation: string; } export interface IndexStats { name: string; type: IndexType; entries: number; size: number; lastUpdated: number; reads: number; writes: number; selectivity: number; } export interface IndexResult { recordIds: string[]; count: number; indexUsed: string; executionTimeMs: number; cost: number; } //# sourceMappingURL=index-types.d.ts.map