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
Generating constants that expose the wire-size of SBE variable length data fields #329
Comments
The |
Thanks @tmontgomery, I wasn't aware of those. Looking at the |
The decoder for var data has the length accessor generated but this is not in the encoder. We could add this. |
Just to clarify I'm not talking about just having access to the encoded length of the field. I'm talking about the encoded size of the length field. For example in the following case its 2:
|
Yes that is what I assumedyou were asking. Look at the CarEncoder and CarDecoder in the samples. The Decoder has it but not the Encoder. |
Perfect, thanks. |
If I want to use SBE in combination with Aeron's
BufferClaim
API then I need to know the size of the message that I want to claim. If the message that I want to encode has no variable length data fields then this is easy, just claim theBLOCK_LENGTH
. If I have variable length data then I need to claimBLOCK_LENGTH
+ the sum of the lengths of variable length + the sizes of the length fields for each variable length data.The sizes of the length fields are stored your SBE's xml schema file, but there is no way from code to get to them without hard coding them in your codebase. If the constants were simply generated as part of the encoders I think it would improve usability of SBE when combined with the
BufferClaim
API.Again for me this is a nice-to-have rather than a high priority issue, however, if you agree with the concept but don't have time to implement I'm happy to contribute a patch.
The text was updated successfully, but these errors were encountered: