Package org.apache.lucene.store
Class IOContext
- java.lang.Object
-
- org.apache.lucene.store.IOContext
-
public class IOContext extends Object
IOContext holds additional details on the merge/search context. A IOContext object can never be initialized as null as passed as a parameter to eitherDirectory.openInput(String, IOContext)orDirectory.createOutput(String, IOContext)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIOContext.ContextContext is a enumerator which specifies the context in which the Directory is being used for.
-
Field Summary
Fields Modifier and Type Field Description IOContext.ContextcontextAn object of a enumerator Context typestatic IOContextDEFAULTFlushInfoflushInfobooleanloadThis flag is used for files that are a small fraction of the total index size and are expected to be heavily accessed in random-access fashion.static IOContextLOADMergeInfomergeInfostatic IOContextRANDOMbooleanrandomAccessThis flag indicates that the file will be accessed randomly.static IOContextREADbooleanreadOnceThis flag indicates that the file will be opened, then fully read sequentially then closed.static IOContextREADONCE
-
Constructor Summary
Constructors Constructor Description IOContext()IOContext(FlushInfo flushInfo)IOContext(IOContext.Context context)IOContext(IOContext ctxt, boolean readOnce)This constructor is used to initialize aIOContextinstance with a new value for the readOnce variable.IOContext(MergeInfo mergeInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)inthashCode()StringtoString()IOContextwithRandomAccess()Return an updatedIOContextthat hasrandomAccessset to true ifcontextisIOContext.Context.READorIOContext.Context.DEFAULT.
-
-
-
Field Detail
-
context
public final IOContext.Context context
An object of a enumerator Context type
-
mergeInfo
public final MergeInfo mergeInfo
-
flushInfo
public final FlushInfo flushInfo
-
readOnce
public final boolean readOnce
This flag indicates that the file will be opened, then fully read sequentially then closed.
-
randomAccess
public final boolean randomAccess
This flag indicates that the file will be accessed randomly. If this flag is set, then readOnce will be false.
-
load
public final boolean load
This flag is used for files that are a small fraction of the total index size and are expected to be heavily accessed in random-access fashion. SomeDirectoryimplementations may choose to load such files into physical memory (e.g. Java heap) as a way to provide stronger guarantees on query latency. If this flag is set, thenrandomAccesswill be true.
-
DEFAULT
public static final IOContext DEFAULT
-
READONCE
public static final IOContext READONCE
-
READ
public static final IOContext READ
-
LOAD
public static final IOContext LOAD
-
RANDOM
public static final IOContext RANDOM
-
-
Constructor Detail
-
IOContext
public IOContext()
-
IOContext
public IOContext(FlushInfo flushInfo)
-
IOContext
public IOContext(IOContext.Context context)
-
IOContext
public IOContext(MergeInfo mergeInfo)
-
IOContext
public IOContext(IOContext ctxt, boolean readOnce)
This constructor is used to initialize aIOContextinstance with a new value for the readOnce variable. This automatically setsrandomAccessandloadtofalse.
-
-
Method Detail
-
withRandomAccess
public IOContext withRandomAccess()
Return an updatedIOContextthat hasrandomAccessset to true ifcontextisIOContext.Context.READorIOContext.Context.DEFAULT. Otherwise, this returns this instance. This helps preserve sequential access for merging, which is always the right choice, while allowingIndexInputs open for searching to use random access.
-
-