import { ErrorInterface, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface"; import FileManager from "../../engine/Filesystem/FileManager"; import FolderManager from "../../engine/Filesystem/FolderManager"; import Converter from "../../Helper/Converter.helper"; import ResponseHelper from "../../Helper/response.helper"; export interface IndexMetaEntry { indexFieldName: string; fileName: string; path: string; } export declare class IndexManager { readonly path: string; readonly indexFolderPath: string; readonly indexMetaPath: string; readonly fileManager: FileManager; readonly folderManager: FolderManager; readonly converter: Converter; readonly ResponseHelper: ResponseHelper; constructor(path: string); /** * Serialize IndexData shape for JSONL file storage. * Line 1 = header (fieldName + sortedValues), remaining lines = one per indexEntries key. * * Example output: * {"h":1,"f":"email","s":[]} * {"k":"alice@x.com","v":["abc123.axiodb"]} */ static serializeIndexData(indexData: { fieldName: string; indexEntries: Record; sortedValues?: number[]; }): string; /** * Deserialize JSONL lines back into an IndexData object. * Expects first line to be the header: { h:1, f, s }. */ static deserializeIndexData(lines: string[]): { fieldName: string; indexEntries: Record; sortedValues: number[]; } | null; /** * Create one or more index files and register them in the index metadata. * * For each supplied field name this method: * 1. Determines the index file path as `${indexName}.jsonl` inside the configured index folder. * 2. Checks whether the index file already exists. If it does not, creates the file with an empty * JSONL index structure (header + no entries). * 3. Appends a JSONL line to `index.meta.jsonl` for each new index — no read-modify-rewrite. * * Creates are now O(1) appends instead of O(N) full-file rewrites for meta. */ createIndex(...fieldNames: string[]): Promise; /** * Deletes an index file and removes its entry from the index metadata. */ dropIndex(indexName: string): Promise; /** * Lists all indexes currently registered for this collection. * Now uses streaming ReadLines for memory efficiency. */ listIndexes(): Promise; /** * Ensures the index folder and the index metadata file exist, creating them if necessary. */ generateIndexMeta(): Promise; /** * Streams index.meta.jsonl lines into an array of IndexMetaEntry objects. */ private listMetaEntries; /** * Finds index metadata entries that correspond to properties present on the provided document. * Streams meta file, returns first match (doesn't parse the entire file). */ protected findMatchingIndexMeta(doc: any): Promise; }