tarlatan
    Preparing search index...

    Interface StoreWriter<E>

    What openWriter needs to know about one store, its own error mapping included.

    interface StoreWriter<E> {
        busyTimeoutMillis: number;
        connect: ConnectSqlite;
        connection: (db: Database) => TxConnection<E>;
        failure: (error: unknown) => E;
        knownVersion: number;
        path: string;
        refused: (reason: string) => E;
        schemaSql: readonly string[];
    }

    Type Parameters

    • E
    Index
    busyTimeoutMillis: number

    How long a statement waits for another connection's lock, in milliseconds.

    connect: ConnectSqlite

    Opens the read-write connection to path; production passes connectSqlite.

    connection: (db: Database) => TxConnection<E>

    The connection's transaction steps, with the store's error mapping.

    failure: (error: unknown) => E

    Maps a thrown SQLite error, or a version row that does not decode, to the store's error.

    knownVersion: number

    The store's own known format version (knownLedgerVersion or knownLogVersion), which its version reads are decided against. The open never stamps it: an unstamped store is stamped 1.

    path: string

    The store's database file.

    refused: (reason: string) => E

    Builds the store's error for a refusal with reason: WAL not taken, or a negative version.

    schemaSql: readonly string[]

    The CREATE ... IF NOT EXISTS statements (and any seed row) that make the store's tables.