Rindle

API index and search · Build metadata

Supporting declarations

packages/remote/src/normalized.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

normalizedFp

/** A `tables` set's content fingerprint — FNV-1a 64 over the canonical, length-prefixed byte
 *  stream of `rindle-replica::normalize_protocol::normalized_fp` (PK resolved to column NAMES),
 *  as 16-char lowercase hex (=== the Rust hex). `tables` MUST be sorted by name (the server's
 *  `NormalizedPublisher` guarantees it) so the fingerprint is order-stable. */
export declare function normalizedFp(tables: NormalizedTableSchema[]): string;

NormalizedHello

/** The slim normalized handshake (§3), sent once before any {@link NormalizedBatch}. */
export interface NormalizedHello {
    epoch: number;
    comparatorVersion: number;
    tables: NormalizedTableSchema[];
    normalizedFp: string;
}

NormalizedBatch

/** One committed transaction's normalized ops (or the seq-0 hydrate snapshot). `cv` (the
 *  global commit version the frame reflects) is stamped by optimistic-protocol servers and
 *  rides through to the `NormalizedEvent` (OPTIMISTIC-WRITES-DESIGN.md §8.3). */
export interface NormalizedBatch {
    epoch: number;
    seq: number;
    normalizedFp: string;
    ops: NormalizedOp[];
    cv?: number;
}

NormalizedSubscriber

/** Receiver side: validates a normalized frame stream (comparator at `hello`; per batch —
 *  epoch match, fingerprint match, strict in-order seq) and emits clean `NormalizedEvent`s.
 *  It does NOT fold (the `NormalizedSync` layer does). Mirrors the flat {@link Subscriber}. */
export declare class NormalizedSubscriber {
    readonly epoch: number;
    readonly normalizedFp: string;
    private readonly emit;
    private phase;
    private lastSeq;
    /**
     * @param hello         the server's normalized handshake.
     * @param emit          clean-event sink (the `NormalizedSync` fold).
     * @param clientTables  the CLIENT's own typed per-table schemas (all tables). When given,
     *   each table the hello advertises is validated by NAME against it (column order + PK
     *   indices). The hello's `tables` is a per-query SUBSET (the query's table tree), so this
     *   checks each advertised table rather than one global fingerprint. A mismatch (routine
     *   deployment / schema skew) is rejected here — without it, positional rows aligned to the
     *   SERVER's column order are stored verbatim under the CLIENT's order, silently swapping
     *   cells and mis-keying the refcount/GC (CRIT#4 / §3 "drift ⇒ re-subscribe").
     */
    constructor(hello: NormalizedHello, emit: (ev: NormalizedEvent) => void, clientTables?: NormalizedTableSchema[]);
    /** Apply one normalized batch (or the seq-0 snapshot). Returns `"duplicate"` for an
     *  already-applied seq; throws {@link ProtocolError} on a gap / epoch / fp mismatch (the
     *  caller re-hydrates under a new epoch). */
    apply(batch: NormalizedBatch): "applied" | "duplicate";
}