MiguelAnzoWizeline commented on pull request #15549:
URL: https://github.com/apache/beam/pull/15549#issuecomment-961265372


   > Your loop `ProcessElement` loop would be like:
   > 
   > ```
   > byteKey = tracker.getRestriction().getStart();
   > while (tryClaim(byteKey)) {
   >   cursor = convertToRedisCursor(byteKey);
   >   values, nextCursor = jedis.scan(cursor);
   >   byteKey = convertToByteKey(nextCursor);
   >   output values
   > }
   > return STOP;
   > ```
   > 
   > You could also create a `RedisCursorRangeTracker` that is a thin wrapper 
over the `ByteKeyRangeTracker` and effectively do conversions only by 
internalizing the `convertToRedisCursor` and `convertToByteKey` methods.
   
   Hi @lukecwik 
   So, in the case of making a wrapper over `ByteKeyRangeTracker` we would have 
the `RedisCursorRangeTracker` and that would have an **internal** 
`ByteKeyRangeTracker`. When calling the `RedisCursorRangeTracker` `tryClaim` 
method this would make the conversion from `RedisCursor` to `ByteKey` and call 
the internal tracker `tryClaim` method, it would also be in this method were it 
would be appropriate to handle the special case when both start and end 
positions are the `0` cursor, and were we could update the range to be 
`[previousEndCursor, newCursor]` to avoid the end cursor to always be `0` since 
that would always fail the `tryClaim`, would that be correct?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to