Implements IPersistBase
Base class for file-based persistence with atomic writes.
Features:
constructor(entityName: EntityName, baseDir: string);
entityName: EntityName
baseDir: string
_directory: string
Computed directory path for entity storage
__@BASE_WAIT_FOR_INIT_SYMBOL@2544: (() => Promise<void>) & ISingleshotClearable
_getFilePath(entityId: EntityId): string;
Computes file path for entity ID.
waitForInit(initial: boolean): Promise<void>;
Initialize persistence directory and validate existing files. Uses singleshot to ensure one-time execution.
readValue<T extends IEntity = IEntity>(entityId: EntityId): Promise<T>;
Read entity from persistence storage.
hasValue(entityId: EntityId): Promise<boolean>;
Check if entity exists in storage.
writeValue<T extends IEntity = IEntity>(entityId: EntityId, entity: T): Promise<void>;
Write entity to storage with atomic file writes.
keys(): AsyncGenerator<EntityId>;
Async generator yielding all entity IDs. Sorted alphanumerically. Used internally by waitForInit for validation.