99
1010import org .apache .logging .log4j .LogManager ;
1111import org .apache .logging .log4j .Logger ;
12+ import org .apache .lucene .store .FlushInfo ;
1213import org .apache .lucene .store .IOContext ;
14+ import org .apache .lucene .store .MergeInfo ;
1315import org .apache .lucene .store .ReadAdvice ;
1416import org .elasticsearch .blobcache .BlobCacheUtils ;
1517import org .elasticsearch .blobcache .common .ByteRange ;
2123import java .io .IOException ;
2224import java .io .InputStream ;
2325import java .nio .ByteBuffer ;
26+ import java .util .Optional ;
27+ import java .util .Set ;
2428import java .util .concurrent .atomic .AtomicLong ;
2529import java .util .function .Predicate ;
2630import java .util .function .Supplier ;
@@ -36,7 +40,42 @@ public class CachedBlobContainerIndexInput extends MetadataCachingIndexInput {
3640 * a complete part of the {@link #fileInfo} at once in the cache and should not be
3741 * used for anything else than what the {@link #prefetchPart(int, Supplier)} method does.
3842 */
39- public static final IOContext CACHE_WARMING_CONTEXT = IOContext .DEFAULT .withReadAdvice (ReadAdvice .NORMAL );
43+ public static final IOContext CACHE_WARMING_CONTEXT = new IOContext () {
44+ @ Override
45+ public Context context () {
46+ return Context .DEFAULT ;
47+ }
48+
49+ @ Override
50+ public MergeInfo mergeInfo () {
51+ return null ;
52+ }
53+
54+ @ Override
55+ public FlushInfo flushInfo () {
56+ return null ;
57+ }
58+
59+ @ Override
60+ public Set <FileOpenHint > hints () {
61+ return Set .of ();
62+ }
63+
64+ @ Override
65+ public IOContext withHints (FileOpenHint ... hints ) {
66+ return this ;
67+ }
68+
69+ @ Override
70+ public Optional <ReadAdvice > readAdvice () {
71+ return Optional .of (ReadAdvice .NORMAL );
72+ }
73+
74+ @ Override
75+ public IOContext withReadAdvice (ReadAdvice advice ) {
76+ return this ;
77+ }
78+ };
4079
4180 private static final Logger logger = LogManager .getLogger (CachedBlobContainerIndexInput .class );
4281
0 commit comments