Package org.elasticsearch.index.translog
Class TranslogReader
org.elasticsearch.index.translog.BaseTranslogReader
org.elasticsearch.index.translog.TranslogReader
- All Implemented Interfaces:
,
,
<BaseTranslogReader>
an immutable translog filereader
-
Field Summary
Fields inherited from class org.elasticsearch.index.translog.BaseTranslogReader
channel, generation, header, path
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
protected boolean
isClosed()
static TranslogReader
channel, path, org.elasticsearch.index.translog.Checkpoint checkpoint, translogUUID)
Given a file channel, opens aTranslogReader
, taking care of checking and validating the file header.protected void
buffer, long position)
reads an operation at the given position into the given buffer.long
int
Methods inherited from class org.elasticsearch.index.translog.BaseTranslogReader
checksummedStream, compareTo, getFirstOperationOffset, getGeneration, getLastModifiedTime, getPrimaryTerm, newSnapshot, path, read, readSize, toString
Methods inherited from class java.lang.
, , , , , , , , ,
-
Field Details
-
length
protected final long length -
closed
protected final closed
-
-
Method Details
-
open
public static channel, path, org.elasticsearch.index.translog.Checkpoint checkpoint, translogUUID) throwsGiven a file channel, opens aTranslogReader
, taking care of checking and validating the file header.- Parameters:
channel
- the translog file channelpath
- the path to the translogcheckpoint
- the translog checkpointtranslogUUID
- the tranlog UUID- Returns:
- a new TranslogReader
- Throws:
- if any of the file operations resulted in an I/O exception
-
sizeInBytes
public long sizeInBytes()- Specified by:
sizeInBytes
in classBaseTranslogReader
-
totalOperations
public int totalOperations()- Specified by:
totalOperations
in classBaseTranslogReader
-
readBytes
protected void readBytes( buffer, long position) throwsreads an operation at the given position into the given buffer.- Specified by:
readBytes
in classBaseTranslogReader
- Throws:
-
close
public final void close() throws- Specified by:
in interface
- Specified by:
in interface
- Throws:
-
isClosed
protected final boolean isClosed() -
ensureOpen
protected void ensureOpen()
-