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 class
IOContext.Context
Context is a enumerator which specifies the context in which the Directory is being used for.
-
Field Summary
Fields Modifier and Type Field Description IOContext.Context
context
An object of a enumerator Context typestatic IOContext
DEFAULT
FlushInfo
flushInfo
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.static IOContext
LOAD
MergeInfo
mergeInfo
static IOContext
RANDOM
boolean
randomAccess
This flag indicates that the file will be accessed randomly.static IOContext
READ
boolean
readOnce
This flag indicates that the file will be opened, then fully read sequentially then closed.static IOContext
READONCE
-
Constructor Summary
Constructors Constructor Description IOContext()
IOContext(FlushInfo flushInfo)
IOContext(IOContext.Context context)
IOContext(IOContext ctxt, boolean readOnce)
This constructor is used to initialize aIOContext
instance with a new value for the readOnce variable.IOContext(MergeInfo mergeInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
hashCode()
String
toString()
IOContext
withRandomAccess()
Return an updatedIOContext
that hasrandomAccess
set to true ifcontext
isIOContext.Context.READ
orIOContext.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. SomeDirectory
implementations 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, thenrandomAccess
will 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 aIOContext
instance with a new value for the readOnce variable. This automatically setsrandomAccess
andload
tofalse
.
-
-
Method Detail
-
withRandomAccess
public IOContext withRandomAccess()
Return an updatedIOContext
that hasrandomAccess
set to true ifcontext
isIOContext.Context.READ
orIOContext.Context.DEFAULT
. Otherwise, this returns this instance. This helps preserve sequential access for merging, which is always the right choice, while allowingIndexInput
s open for searching to use random access.
-
-