IncrementalFileIndexComponentConstructorParams<T>
Dependencies of an incremental index. Persistence must validate its own schema.
Import:
import type { IncrementalFileIndexComponentConstructorParams } from '@mnaoumov/obsidian-lib/components/incremental-file-index-component';Signature:
export interface IncrementalFileIndexComponentConstructorParams<T>Properties
| Property | Type | Description |
|---|---|---|
| accepts | (file: TFile) => boolean | Files accepted by this index, for example Markdown files only. |
| app | App | The application owning the vault. |
| indexFile | (params: IndexFileParams) => T | Builds an immutable record synchronously; text is never retained by this component. |
| load | () => Promise<ReadonlyMap<string, IndexedFileRecord<T>>> | Reads validated records, or an empty map for a missing/incompatible cache. |
| onRemove | (path: string) => void | Removes a record from a consumer's secondary index. Called for known records only. |
| onSet | (path: string, record: T) => void | Updates a consumer's secondary index, including restored records. |
| save | (records: ReadonlyMap<string, IndexedFileRecord<T>>) => Promise<void> | Persists a snapshot; writes are serialized and retried by the next flush after failure. |
| shouldAwaitMetadataChange? | (file: TFile) => boolean | Whether a create or modify of the file is followed by a metadata-cache changed event carrying its text, as for Markdown notes. Such a file drops its stale projection and is not read; its record returns with that event, or with the next startup or IncrementalFileIndexComponent.rescan when Obsidian raises none (a modify that left the content unchanged). Consumers must treat a file without a record as unknown. Defaults to never. |
| shouldMoveRecordsOnRename? | boolean | Whether a projection depends on text alone, so a rename moves it with its stats instead of reading the file again. A file renamed to a path accepts rejects loses its record either way. Defaults to false. |
Links to this page: