ChrisHegarty commented on code in PR #13570: URL: https://github.com/apache/lucene/pull/13570#discussion_r1677621308
########## lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java: ########## @@ -199,20 +203,27 @@ public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); ensureCanRead(name); Path path = directory.resolve(name); - return PROVIDER.openInput(path, context, chunkSizePower, preload.test(name, context)); + return PROVIDER.openInput( + path, context, chunkSizePower, preload.test(name, context), attachment); } // visible for tests: - static final MMapIndexInputProvider PROVIDER; + static final MMapIndexInputProvider<Object> PROVIDER; - interface MMapIndexInputProvider { - IndexInput openInput(Path path, IOContext context, int chunkSizePower, boolean preload) + interface MMapIndexInputProvider<A> { + IndexInput openInput( + Path path, IOContext context, int chunkSizePower, boolean preload, A attachment) throws IOException; long getDefaultMaxChunkSize(); boolean supportsMadvise(); + /** An optional attachment of the provider, that will be passed to openInput. */ + default Optional<A> attachment() { Review Comment: The alternative, of course, is to just drop the use of generics here and use `Object`. -- 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