ChrisHegarty commented on code in PR #13570: URL: https://github.com/apache/lucene/pull/13570#discussion_r1679175111
########## lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java: ########## @@ -199,20 +202,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. */ Review Comment: Exactly. Additionally, we avoid the prefix `newXX`, or `createXX`, which prescribes that the implementation _must_ return a new instance. This may not be the case. In fact, an implementation could even choose to return a Supplier of XX if it wanted to. The point is that it can be almost anything. -- 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