API reference › @evolu/sqlite-wasm › SahPool

Defined in: packages/sqlite-wasm/src/SahPool.ts:388

A pool of sync access handles, and the VFS SQLite opens its files with, on which File and EncryptedFile databases open.

Extends

Properties

clearFailure

readonly clearFailure: () => void;

Defined in: packages/sqlite-wasm/src/SahPool.ts:406

Forgets the recorded failure; a database calls it before each operation that does not run inside another operation on the pool.


getFailure

readonly getFailure: () =>
  | SqliteVfsFailure
  | null;

Defined in: packages/sqlite-wasm/src/SahPool.ts:400

Returns the first failure a method of the pool recorded since the last SahPool.clearFailure, which a SqliteError carries as its cause.


getPaths

readonly getPaths: () => readonly string[];

Defined in: packages/sqlite-wasm/src/SahPool.ts:414

Returns the canonical paths of the files the pool has, databases and their journals, such as /evolu1.db, so a database opened at a SqliteVfsPath is listed by that path. A file SQLite's opfs-sahpool opened as evolu1.db is listed as /evolu1.db.


read

readonly read: (path: string, offset: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">, byteLength: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">) => Result<Uint8Array<ArrayBuffer>,
  | SqliteVfsIoError
| SahPoolFileNotFoundError>;

Defined in: packages/sqlite-wasm/src/SahPool.ts:433

Reads bytes of a file without SQLite, such as the first 16 bytes of an encrypted database, which are its cipher salt. The path is one SahPool.getPaths returns, and the offset counts from the start of the file's data, after the header. Fewer bytes come back at the end of the file.


unlink

readonly unlink: (path: string) => Result<boolean, SqliteVfsIoError>;

Defined in: packages/sqlite-wasm/src/SahPool.ts:424

Deletes the file with a canonical path, as SahPool.getPaths returns it, and the files SQLite keeps beside it, such as its -journal. The file goes first, so a failure never leaves a database without the journal that would roll it back. Returns false when the pool has no file with the path, as for a path that is not canonical, and throws when a connection has one of the files open.


vfsName

readonly vfsName: string;

Defined in: packages/sqlite-wasm/src/SahPool.ts:393

The name of the pool's VFS, which a database opens its path with, such as opfs-sahpool:.evolu. It names Evolu's codec over the pool.

Methods

[dispose]()

[dispose](): void;

Defined in: node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34

Inherited from

Disposable.[dispose]