tarlatan
    Preparing search index...

    Variable openLedgerConst

    openLedger: (
        path: string,
        busyTimeoutMillis: number,
    ) => Effect.Effect<
        LedgerStore,
        LedgerError
        | LedgerBusy
        | StoreVersionNewer,
        Scope.Scope,
    > = ...

    Opens (creating if needed) the ledger at path for the scope, in WAL mode with busy_timeout set to busyTimeoutMillis on every connection it makes, and closes it when the scope ends. That is how it meets Domain's busy-wait contract (LedgerStore): a write that meets another writer's lock waits up to busyTimeoutMillis, as SQLite documents for busy_timeout (sqlite.org/pragma.html#pragma_busy_timeout, sqlite.org/c3ref/busy_timeout.html), and then fails with LedgerBusy and writes nothing. SQLite's documented behaviour is the evidence for the wait; no test observes it. The open itself takes the write lock briefly, so it can wait as long and fail with LedgerBusy too. A ledger at format version 0 (written by v0.1.0) is stamped 1 and a new one is created at 1. A ledger stamped by a newer release fails with StoreVersionNewer, and one stamped below 0 with LedgerError; either is left as it was, read and written by nothing.

    Type Declaration