Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
grlrrchapman opened this issue Jan 3, 2023 · 1 comment
Open

Comments

@grlrrchapman
Copy link

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.

@vyazelenko
Copy link
Contributor

See #957.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants