import type { JsDb } from './feltdb.js'; import type { FreshnessCapability } from './freshness.js'; import type { OperationAdmissionInput, OperationAdmissionResult, OperationTransitionInput, OperationTransitionResult } from './operation-admission.js'; import type { AtomicTransactionRequest, AtomicTransactionResult } from './transaction.js'; import type { AuthorityQueryRequest } from './http-db.js'; interface JsResult { success: boolean; data?: string; error?: string; } interface PortableEvent { sequence: number; collection: string; key: string; type: 'put' | 'delete'; timestamp: number; id: string; origin: string; value?: unknown; } export declare class FileJsDb implements JsDb { private readonly dataPath; private readonly statePath; private readonly lockPath; private state; private readonly origin; private readonly peers; private lockFd; private lockToken; private readonly applied; private readonly queryEngine; private indexedSequence; constructor(path: string); private loadState; private loadStateFromBackup; private initializeState; private restorePeers; private isStalelock; private cleanupStaleLock; private acquireLockAsync; private releaseLockAsync; private ownsLock; private acquireLockSync; private withMutationLock; private refresh; private saveState; private event; /** * Commit several operations atomically and durably. * * The snapshot is published by writing a temporary file, fsyncing it, and * renaming it over the previous one. The rename is atomic, so a reader sees * either the whole transaction or none of it, and a crash at any point * leaves one of those two states on disk — never a mixture. * * Order matters here. The next state is built and persisted *before* it is * adopted in memory, so a failed write cannot leave memory ahead of disk. */ commit_transaction(request: AtomicTransactionRequest): Promise; insert(key: string, value: string): JsResult; update(key: string, value: string): JsResult; get(key: string): JsResult; delete(key: string): JsResult; query(capability: string): JsResult; authority_query>(query: AuthorityQueryRequest): Promise & { stats: import("./embedded-query.js").EmbeddedQueryStats; }>; explain_query(query: AuthorityQueryRequest): import("./embedded-query.js").EmbeddedQueryExplanation; rebuild_indexes(): void; get_capability_records(capability: string): JsResult; execute_op(): JsResult; sync_info(): JsResult; add_peer(): JsResult; add_sync_peer(peerId: string): JsResult; remove_sync_peer(peerId: string): JsResult; acknowledge_peer_operations(): JsResult; get_pending_for_peer(): JsResult; instance_id(): string; get_sequence(): number; /** * The file runtime uses explicit refresh validation. Cross-process mutations * are serialized and reads reload the committed snapshot, but the public read * contract does not yet return a scoped revision alongside its value. */ freshness(): FreshnessCapability; audit_events(): PortableEvent[]; /** Read-only projection of the materialized authority state. */ authorityStateSummary(): { current_sequence: number; records: number; events: number; collections: Array<{ collection: string; records: number; }>; }; export_operations(sinceSequence: number): PortableEvent[]; apply_remote_operations(operations: PortableEvent[]): { applied: number; ignored: number; }; allocateSequence(params: { scope: string; scopeId: string; }): Promise; putIfAbsent(key: string, value: string): Promise<{ inserted: boolean; value: string; }>; admitOperation(input: OperationAdmissionInput): Promise; transitionOperation(input: OperationTransitionInput): Promise; cas(params: { key: string; expectedVersion: number; expectedEpoch?: number; expectedLeaseId?: string; rejectIfDiverged?: boolean; value: string; }): Promise<{ updated: boolean; currentVersion: number; currentEpoch?: number; conflictCode?: string; item?: any; }>; close(): void; } export {}; //# sourceMappingURL=file-db.d.ts.map