Rindle

API index and search · Build metadata

Supporting declarations

rust/rindle-replica-node/src/index.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

ReplicaBackend

/** The in-process, SQLite-backed native backend. Each instance owns its own replica (a
 *  temporary WAL database). Registers every schema table on construction. This wrapper has no
 *  database-path option and does not persist application data across process restarts. */
export declare class ReplicaBackend<S extends ColsMap> implements Backend {
    private readonly db;
    private handler;
    private boundaryHandler;
    private readonly dispatchQueue;
    private draining;
    constructor(schema: Schema<S>);
    registerQuery(qid: QueryId, ast: Ast): void;
    unregisterQuery(qid: QueryId): void;
    mutate(mutations: Mutation[]): Promise<void>;
    onEvent(handler: (qid: QueryId, ev: ChangeEvent) => void): void;
    /** Register the Store's commit-boundary handler ({@link Backend.onCommitBoundary}): `dispatch`
     *  calls it around each commit's per-query batch delivery so the Store can fold every affected
     *  view before notifying any subscriber. */
    onCommitBoundary(handler: (phase: "begin" | "end") => void): void;
    /** Deliver one commit's per-query batches — a faithful mirror of `WasmBackend.dispatch`.
     *  Non-reentrant: if a delivery is already in progress (a subscriber re-entered via `write()`),
     *  enqueue and let the active drain pick it up FIFO, so each query folds commits in order.
     *  Per-query isolated: a view's fold or subscriber throwing does NOT drop sibling queries'
     *  batches — the first error is re-raised only after every query has been delivered.
     *
     *  Cross-view-atomic notification: each commit is bracketed with `boundaryHandler("begin"/"end")`
     *  so the Store folds ALL of this commit's views before notifying ANY subscriber (a subscriber
     *  re-reading a sibling view then sees post-commit data). `begin`/`end` stay balanced even if a
     *  fold throws (the `finally`), and a re-entrant write enqueued during the `end` flush drains as
     *  its own bracketed commit in the next loop turn. */
    private dispatch;
}

createReplicaStore

/** Create a local {@link Store} over a fresh temporary SQLite database. The schema creates the
 *  tables; there is no file-path or restart-persistence option. Destroy materialized views when
 *  finished. The native replica's temporary files are removed when its handle is finalized. */
export declare function createReplicaStore<S extends ColsMap>(schema: Schema<S>): Store<S>;