SEMQ TypeScript API
    Preparing search index...

    Class Floor

    An envelope of observed variation, (changedRows, totalRows, hamming) measured from nulls null diffs, bound to the config, the id kind and the reference state those nulls were taken against.

    A diff is within the floor when it removes no rows, shares at least one row with its reference, changes at most changedRows / totalRows of the shared rows, its p99 hamming does not exceed hamming, and it changes neither encoder nor encoder_revision. Applying a floor to a diff of another config, id kind or reference throws Incompatible. No probabilistic coverage is claimed.

    Floor.measure(diffs, { perRow: true }) also records the per-row data the per-row check of Diff.evaluate needs: maxHamming, the largest hamming of any changed row of any null, and distinctNulls. Without it the JSON form is the one SEMQ 1.0 reads. The JSON form (Floor.toJson, Floor.fromJson, Floor.asDict, Floor.fromDict) is written and read by the core, with the same rules in every binding.

    Owns a native handle: call Floor.dispose when done, or let the finalizer free it.

    Index
    • A floor from its fields. referenceId is the stateId of the reference (32 bytes); counts are numbers. The core validates the rest: nulls >= 1, totalRows >= 1, changedRows <= totalRows and hamming <= config.unitsPerRow; anything else is InvalidInput. The floor has no per-row data: that comes only from Floor.measure or Floor.fromJson.

      Parameters

      • fields: {
            changedRows: number;
            config: CodecConfig;
            hamming: number;
            idKind: "u64" | "utf8";
            nulls: number;
            referenceId: Uint8Array;
            totalRows: number;
        }

      Returns Floor

    • get distinctNulls(): number | undefined

      How many of the nulls were distinct states, from 1 to nulls: two nulls are the same when their candidates have the same contentDigest. With 1 the per-row check adds no false alarm; when the nulls vary, each check can reject an unchanged rebuild with probability up to 1 / (nulls + 1). undefined for a floor without per-row data.

      Returns number | undefined

    • get idKind(): "u64" | "utf8"

      Returns "u64" | "utf8"

    • get maxHamming(): number | undefined

      The largest hamming of any changed row of any null (0 when no null changed a row); undefined for a floor without per-row data: one from the constructor, from measure without perRow, or read from JSON without it.

      Returns number | undefined

    • get nulls(): number

      How many null diffs the floor was measured from.

      Returns number

    • get referenceId(): Uint8Array

      stateId of the reference the nulls were taken against (32 bytes).

      Returns Uint8Array

    • The floor schema as a plain object (JSON.parse of Floor.toJson): the config as in diff reports, the reference id as lowercase hex, counts as numbers.

      Returns {
          changed_rows: number;
          config: Record<string, string | number>;
          distinct_nulls?: number;
          hamming: number;
          id_kind: "u64" | "utf8";
          max_hamming?: number;
          nulls: number;
          reference_id: string;
          total_rows: number;
          version: "semq-floor/1";
      }

    • Release the native handle. Idempotent; later use raises InvalidInput.

      Returns void

    • True when other has the same nine fields.

      Parameters

      Returns boolean

    • The floor's JSON form, written by the core: the floor schema with max_hamming and distinct_nulls when the floor records them, keys in schema order, no whitespace. The same text in every binding.

      Returns string

    • Floor(1 of 3 rows, hamming 1, from 3 nulls); the same text in every binding.

      Returns string

    • Read a floor from its JSON form, by the core's rules: the schema's keys strictly (each at most once, integer counts, max_hamming and distinct_nulls optional), other keys ignored, and the construction rules. Anything else is InvalidInput.

      Parameters

      • json: string | Uint8Array<ArrayBufferLike>

      Returns Floor

    • The envelope of one or more null diffs of one reference; every input is within the result. Incompatible when the nulls differ in config, id kind or reference (field is the offending index); InvalidInput when one is not a null: rows added or removed, none in common, or a change to encoder or encoder_revision. The floor records no per-row data.

      Parameters

      Returns Floor

    • Floor.measure that also records what the checks in options need: with { perRow: true }, maxHamming and distinctNulls for the per-row check. SEMQ 1.0 cannot read a floor saved with them.

      Parameters

      Returns Floor