uschindler commented on code in PR #13219: URL: https://github.com/apache/lucene/pull/13219#discussion_r1539407232
########## lucene/core/src/java/org/apache/lucene/store/IOContext.java: ########## @@ -54,58 +43,74 @@ public enum Context { DEFAULT }; - public static final IOContext DEFAULT = new IOContext(Context.DEFAULT); + /** Advice regarding the read access pattern. */ + public enum ReadAdvice { + /** + * Normal behavior. Data is expected to be read mostly sequentially. The system is expected to + * cache the hottest pages. + */ + NORMAL, + /** + * Data is expected to be read in a random-access fashion, either by {@link + * IndexInput#seek(long) seeking} often and reading relatively short sequences of bytes at once, + * or by reading data through the {@link RandomAccessInput} abstraction in random order. + */ + RANDOM, + /** Data is expected to be read sequentially with very little seeking at most. */ + SEQUENTIAL, + /** + * Data is treated as random-access memory in practice. {@link Directory} implementations may + * explicitly load the content of the file in memory, or provide hints to the system so that it + * loads the content of the file into the page cache at open time. This should only be used on + * very small files that can be expected to fit in RAM with very high confidence. + */ + LOAD + } + + public static final IOContext DEFAULT = + new IOContext(Context.DEFAULT, null, null, ReadAdvice.NORMAL); - public static final IOContext READONCE = new IOContext(true, false, false); + public static final IOContext READONCE = new IOContext(ReadAdvice.SEQUENTIAL); - public static final IOContext READ = new IOContext(false, false, false); + public static final IOContext READ = new IOContext(ReadAdvice.NORMAL); - public static final IOContext LOAD = new IOContext(false, true, true); + public static final IOContext LOAD = new IOContext(ReadAdvice.LOAD); - public static final IOContext RANDOM = new IOContext(false, false, true); + public static final IOContext RANDOM = new IOContext(ReadAdvice.RANDOM); Review Comment: We can still refactor and rename them a bit. The LOAD should really be PRELOAD. -- 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