SEMQ TypeScript API
    Preparing search index...

    Class Encoding

    An immutable set of ids with one canonical row each, a manifest and two identities. contentDigest identifies the rows under the rule; stateId adds the manifest. Equality of two Encodings is equality of stateId. Every accessor returns a copy; the rows live in wasm memory until Encoding.dispose or the finalizer runs.

    Index
    • Build from rows the caller already holds: rows.length === n * bytesPerVector, in the order of ids. The core sorts by id, rejects duplicates and non-canonical rows, copies the rows once and computes both digests. idKind is required when there are no ids.

      Parameters

      • init: {
            config: CodecConfig;
            idKind?: "u64" | "utf8";
            ids: string[] | bigint[];
            manifest?: Record<string, string>;
            rows: Uint8Array;
        }

      Returns Encoding

    • get contentDigest(): Uint8Array

      SHA-256 identity of the rows under the rule (32 bytes).

      Returns Uint8Array

    • get ids(): string[] | bigint[]

      Sorted ids: bigint[] for u64, string[] for utf8 (a copy).

      Returns string[] | bigint[]

    • get manifest(): Record<string, string>

      Manifest pairs in canonical (bytewise key) order, as a plain object whose every key is an own property (a key named __proto__ included).

      Returns Record<string, string>

    • get rows(): Uint8Array

      Canonical rows in id order, n * bytesPerVector bytes (a copy).

      Returns Uint8Array

    • get stateId(): Uint8Array

      Identity of rows plus manifest (32 bytes).

      Returns Uint8Array

    • [id, row] pairs in canonical order.

      Returns IterableIterator<[string | bigint, Uint8Array<ArrayBufferLike>]>

    • Merge with Encodings of the same config, kind and manifest and disjoint ids. Commutative and associative; the empty Encoding is neutral.

      Parameters

      Returns Encoding

    • Release the native handle. Idempotent; later use raises InvalidInput. A Diff built from this Encoding stays valid.

      Returns void

    • True when other has the same stateId: the same rows under the same rule, with the same manifest.

      Parameters

      Returns boolean

    • The row of id (a copy), or undefined when absent. InvalidInput for an id of the wrong kind.

      Parameters

      • id: string | bigint

      Returns Uint8Array<ArrayBufferLike> | undefined

    • Row i in id order (a copy).

      Parameters

      • i: number

      Returns Uint8Array

    • Encoding(3 rows, quant(dim=4, bins=4), state_id 40c3aa20252d...); the same text in every binding.

      Returns string

    • Parse a complete file image. Validates framing, sizes, ids, manifest, both digests and row canonicity; always copies.

      Parameters

      • data: Uint8Array

      Returns Encoding