@llamaindex/core
Version:
LlamaIndex Core Module
29 lines (26 loc) • 1.34 kB
TypeScript
import { StoredValue } from '../../../schema/dist/index.js';
declare abstract class BaseKVStore {
abstract put(key: string, val: StoredValue, collection?: string): Promise<void>;
abstract get(key: string, collection?: string): Promise<StoredValue>;
abstract getAll(collection?: string): Promise<Record<string, StoredValue>>;
abstract delete(key: string, collection?: string): Promise<boolean>;
}
declare abstract class BaseInMemoryKVStore extends BaseKVStore {
abstract persist(persistPath: string): void;
static fromPersistPath(persistPath: string): BaseInMemoryKVStore;
}
type DataType = Record<string, Record<string, StoredValue>>;
declare class SimpleKVStore extends BaseKVStore {
private data;
private persistPath;
constructor(data?: DataType);
put(key: string, val: StoredValue, collection?: string): Promise<void>;
get(key: string, collection?: string): Promise<StoredValue>;
getAll(collection?: string): Promise<Record<string, StoredValue>>;
delete(key: string, collection?: string): Promise<boolean>;
persist(persistPath: string): Promise<void>;
static fromPersistPath(persistPath: string): Promise<SimpleKVStore>;
toDict(): DataType;
static fromDict(saveDict: DataType): SimpleKVStore;
}
export { BaseInMemoryKVStore, BaseKVStore, type DataType, SimpleKVStore };