Skip to content

Length encoding for dynamically growing array #101

@Pique7

Description

@Pique7

From what I understand, there are 3 ways to deal with dynamically growing arrays or data in CBOR:

  1. Define an array with a specific length and update the length encoding of the array when a new element is added.
  2. Define an indefinite array with terminator byte.
  3. Define an array with an estimated/foreknown maximum length and fill unused entries with null.

My problem with solution 1 is, that the number of bytes of the length encoding may change when the array size exceeds specific limits (e.g. 23/24 or 255/256 I think), Is there another way to encode the length of the array, ensuring that the number of bytes of the length encoding remains constand (e.g. always 4 bytes for encoding the length of the array)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions