Skip to content

DTOs to help with variable-length in non-latency-critical contexts #923

Closed
@grlrrchapman

Description

@grlrrchapman

Accessing a variable length SBE property modifies the state of the auto-generated SBE classes by advancing an offset field. Client code has to access every variable length property exactly once, in order. It's common to pass around lists or strings whose length we can't know ahead of time; in such cases SBE client code is brittle and hard to debug.

Could you add auto-generated DTOs to the SBE code-gen to mitigate this problem? The requirements for these objects would be:

  • Safe to get or set any property in any order
  • Index-based access for array-like collections
  • Use separately allocated memory for the DTOs, with methods to convert the DTOs to / from the wire format

The DTOs would be really useful in non-latency-critical scenarios such as testing, debugging tools and post-processing of persisted messages. It's understood that using the DTOs will incur a performance penalty.

C++ / C# are the two languages used by the author of this request, but I can imagine other users wanting this feature in code-gen for other languages.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions