SofaBuffers TypeScript - v0.12.0
    Preparing search index...

    Class BlobSeq

    Collects the elements of a blob wrapper-sequence array into out. The string twin above, with two differences: the payload is stored as bytes rather than decoded, and gaps are filled with an empty Uint8Array.

    Each element is storage of its own — what PayloadAcc returns is a buffer it allocated and handed over, or in reuse mode one the destination already held, never a view into the fed chunk (§6.7) — so a stored element cannot rot when the caller reuses its input.

    The destination, placed at out[id].

    The decoder's shared PayloadAcc.

    The schema count as an index capacity, or UNBOUNDED (-1) for unbounded.

    The element maxlen in bytes, or UNBOUNDED (-1) for an element the schema left open, where receiverElemMax governs instead.

    The schema field name, used only in the rejection message.

    The receiver-side index cap for a schema-unbounded array (§6.2.1) — see StringSeq. Required, with no default.

    The receiver-side max_dyn_blob_len for a schema-unbounded element (§6.2.1) — see StringSeq. Required, with no default.

    Index
    • Parameters

      • out: Uint8Array<ArrayBufferLike>[]
      • acc: PayloadAcc
      • cap: number
      • elemMax: number
      • name: string
      • receiverCap: number
      • receiverElemMax: number

      Returns BlobSeq

    cap: number
    elemMax: number
    name: string
    out: Uint8Array<ArrayBufferLike>[]
    receiverCap: number
    receiverElemMax: number
    • One payload piece of element id (Visitor.blob).

      Parameters

      • id: number
      • total: number
      • offset: number
      • src: Uint8Array
      • start: number
      • end: number

      Returns void

    • The array has ended: cut out to this decode's length — ElementSeq.end — and disarm, so an element after it costs nothing for a window that is gone.

      Returns void

    • Arm reuse mode — see ElementSeq.reuse, and here it reaches the element's own storage too: where the previous decode left a Uint8Array at this index and the payload now arriving is exactly its length, the payload is written into that buffer (PayloadAcc.takeInto) instead of into a new one. A length that does not match allocates, as always — the buffer's length is the element's length, so there is nothing to trim it with.

      The buffer the previous decode handed out is therefore overwritten: a caller that kept a reference to an element of an earlier message sees it change. That is what decoding into a reused destination means, one level down.

      And it is overwritten as the pieces arrive, which is what buys the chunked path. So a decode abandoned part-way through an element's payload — a chunk boundary that never gets its continuation, an INVALID later in the message, a one-shot buffer that ends inside the payload — leaves that one element holding a mix of the new payload's leading bytes and the old one's tail: not the value that was there, and not a value that was ever on the wire. Every other element of the retained message is untouched, and the ones this decode completed are complete. A caller that falls back to the last good message cannot rely on the element the abandoned decode had already started — whether it was abandoned by a refusal or by a truncation tryDecode reported as a returned Incomplete; nothing short of buffering the payload elsewhere would change that, and buffering it is the allocation this mode exists to remove.

      Returns this

      this collector, so it can be armed where it is built.