Issues with BufferClaim and ideas #1961
iceberglet
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, while using aeron & aeron cluster, I came across the following pain points around
BufferClaim:tryClaimwith its ownBufferClaiminstance, which is hard to mock behaviours even if captured.I don't have good ideas which wouldn't involving API breaking changes : ( Just raising a point here in case someone has good ideas
tryClaimmethods in various aeron cluster components will insert extra headers. Example beingClusteredServiceAgentwhich adds aSESSION_HEADER_LENGTH. When invoking on suchtryClaimthe programmer has to be very careful and apply a correct offset, as theBufferClaim's offset is hardcoded to be only aeron transport header frame size.Suggestion:
msgOffsetintoBufferClaimadvanceMsgOffset(int)andmsgOffset()wraponBufferClaim, initializemsgOffsettoHEADER_LENGTH(which is aeron transport's header)tryClaimwhere an inner header is added,advanceMsgOffsetshould be called to incrementmsgOffset. In theClusteredServiceAgentexample, it should increment bySESSION_HEADER_LENGTHmsgOffset()rather thanoffset()when wrapping encoders, avoiding confusionsBeta Was this translation helpful? Give feedback.
All reactions