paulirwin commented on code in PR #1195: URL: https://github.com/apache/lucenenet/pull/1195#discussion_r2392119295
########## src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs: ########## @@ -103,6 +104,48 @@ private void CheckDiskFull(byte[] b, int offset, DataInput @in, long len) } } + // LUCENENET specific overload + private void CheckDiskFull(ReadOnlySpan<byte> source) Review Comment: Low priority, since this is Test Framework code, but this logic is pretty repetitive from the original above, which could make maintenance harder down the road. I would consider refactoring this to a shared method that takes a delegate callback for the write/copy bytes bit, like `delegate void WriteCheckDiskFullBytes(IndexOutput @delegate, long freeSpace)` then make the refactored shared method be `private void CheckDiskFullInternal(long len, WriteCheckDiskFullBytes callback)` - I think that would work from reading the code but might be missing something. I think the byte array, offset, and DataInput could be captured by the lambda in the byte array overload case, and the span could be captured/copied by the lambda. If the lambda is then marked `static` it would help ensure we avoid an allocation. Also, I think the method(s) could use XML doc comments explaining what exactly it's doing, since I think doing I/O in a method with a name and signature like this is a little counterintuitive. -- 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: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org