import type { Document } from './document'; import type { Schema } from './schema'; import type { Searcher, Subscriber } from './searcher'; export interface Index extends IndexReader, Searcher, Subscriber { write(): Promise>; clear(): Promise; } export interface IndexWriter extends IndexReader, Searcher { insert(document: Document): void; put(document: Document): void; delete(id: string): void; // TODO(@eyhn) // deleteByQuery(query: Query): void; commit(): Promise; rollback(): void; } export interface IndexReader { get(id: string): Promise | null>; getAll(ids: string[]): Promise[]>; has(id: string): Promise; } export interface IndexStorage { getIndex(name: string, schema: S): Index; }