import type { CoValueHeader, Transaction } from "../../coValueCore/verifiedState.js"; import type { Signature } from "../../crypto/crypto.js"; import type { RawCoID, SessionID } from "../../exports.js"; import type { CoValueKnownState } from "../../knownState.js"; import type { DBClientInterfaceAsync, DBTransactionInterfaceAsync, SessionRow, SignatureAfterRow, StorageReconciliationLockRow, StoredCoValueRow, StoredSessionRow, TransactionRow, StorageReconciliationAcquireResult } from "../types.js"; import type { SQLiteDatabaseDriverAsync } from "./types.js"; import type { PeerID } from "../../sync.js"; export type RawCoValueRow = { id: RawCoID; header: string; }; export type RawTransactionRow = { ses: number; idx: number; tx: string; }; export declare function getErrorMessage(error: unknown): string; /** * Executes storage operations inside a single DB transaction. */ export declare class SQLiteTransactionAsync implements DBTransactionInterfaceAsync { private readonly tx; constructor(tx: SQLiteDatabaseDriverAsync); getSingleCoValueSession(coValueRowId: number, sessionID: SessionID): Promise; markCoValueAsDeleted(id: RawCoID): Promise; addSessionUpdate({ sessionUpdate, }: { sessionUpdate: SessionRow; sessionRow?: StoredSessionRow; }): Promise; addTransaction(sessionRowID: number, nextIdx: number, newTransaction: Transaction): Promise; addSignatureAfter({ sessionRowID, idx, signature, }: { sessionRowID: number; idx: number; signature: Signature; }): Promise; deleteCoValueContent(coValueRow: Pick): Promise; getStorageReconciliationLock(key: string): Promise; putStorageReconciliationLock(entry: StorageReconciliationLockRow): Promise; } export declare class SQLiteClientAsync implements DBClientInterfaceAsync { private readonly db; /** Serialize transactions to avoid SQLITE_BUSY errors */ private txQueue; constructor(db: SQLiteDatabaseDriverAsync); private enqueueTx; getCoValue(coValueId: RawCoID): Promise; getCoValueSessions(coValueRowId: number): Promise; getNewTransactionInSession(sessionRowId: number, fromIdx: number, toIdx: number): Promise; getSignatures(sessionRowId: number, firstNewTxIdx: number): Promise; getCoValueRowID(id: RawCoID): Promise; upsertCoValue(id: RawCoID, header?: CoValueHeader): Promise; eraseCoValueButKeepTombstone(coValueId: RawCoID): Promise; getAllCoValuesWaitingForDelete(): Promise; transaction(operationsCallback: (tx: DBTransactionInterfaceAsync) => Promise): Promise; getUnsyncedCoValueIDs(): Promise; trackCoValuesSyncState(updates: { id: RawCoID; peerId: PeerID; synced: boolean; }[]): Promise; stopTrackingSyncState(id: RawCoID): Promise; getCoValueIDs(limit: number, offset: number): Promise<{ id: RawCoID; }[]>; getCoValueCount(): Promise; tryAcquireStorageReconciliationLock(sessionId: SessionID, peerId: PeerID): Promise; renewStorageReconciliationLock(sessionId: SessionID, peerId: PeerID, offset: number): Promise; releaseStorageReconciliationLock(sessionId: SessionID, peerId: PeerID): Promise; getCoValueKnownState(coValueId: string): Promise; } //# sourceMappingURL=client.d.ts.map