import type { JsDb } from './feltdb.js'; import { type FreshnessCapability, type Revision } from './freshness.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; } /** In-process runtime used by the synchronous createFeltDB API. */ export declare class MemoryJsDb implements JsDb { private readonly rows; private readonly events; private sequence; private readonly origin; private readonly revisionState; private readonly peers; private readonly applied; private readonly queryEngine; private indexedRevision; constructor(namespace: string); private event; /** * Commit several operations atomically. * * The plan is decided against current state before anything is written, and * the writes then happen with no `await` between them, so no other caller * can observe a partially applied transaction. * * This runtime is atomic but not durable: nothing survives process exit. * That is a property of an in-memory store, not a weaker transaction * contract. */ 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; putIfAbsent(key: string, value: string): Promise<{ inserted: boolean; value: string; }>; cas(params: { key: string; expectedVersion: number; expectedEpoch?: number; value: string; }): Promise<{ updated: boolean; currentVersion: number; currentEpoch?: number; item?: any; }>; 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; /** * One process, one event loop, one shared namespace record. * * Nothing outside this process can write these rows, and every handle on the * namespace advances the same counter, so the counter is authoritative for * the domain it represents. That stops being true the moment replication * touches the namespace. */ freshness(): FreshnessCapability; revision(): Promise; audit_events(): PortableEvent[]; export_operations(sinceSequence: number): PortableEvent[]; apply_remote_operations(operations: PortableEvent[]): { applied: number; ignored: number; }; } export {}; //# sourceMappingURL=memory-db.d.ts.map