uschindler commented on PR #12841:
URL: https://github.com/apache/lucene/pull/12841#issuecomment-1849057360

   Hi, I was busy this Sunday, sorry for delay. Will check tomorrow.
   
   In general: My idea is to have a single static utility method (like the 
default one) in the util class that does the *whole* readGroupVInt, but that 
also (additionally) takes a lambda to random-access read the integer and also 
takes a parameter with the maximum size available in the context of the caller 
for random access reads with the lambda. MemorySegmentIndexInput would pass the 
segment.byteSize()-position, while ByteBuffers would pass remaining(). It would 
also take the reference offset of the *actual* position so it knows what to add 
for random-access reads). As return value it would return the new position. 
Both (reference position before the first block and return value) would be 
relative for usage by the lambda. The caller then just calls the method with 
the lambda (possibly wrapping the whole call with the usual NPE/ISE try-catch 
block).
   
   This would allow an easy implementation by 3rd party directory 
implementations without knowing how readGroupVInt works internally. 3rd party 
implementations and our own MMap/NIO/... would just call this static method if 
they support random access or call super(), if they can't.


-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to