Package org.elasticsearch.index.translog
Class BaseTranslogReader
org.elasticsearch.index.translog.BaseTranslogReader
- All Implemented Interfaces:
<BaseTranslogReader>
- Direct Known Subclasses:
TranslogReader
,TranslogWriter
A base class for all classes that allows reading ops from translog files
-
Field Summary
Modifier and TypeFieldDescriptionprotected
protected long
protected org.elasticsearch.index.translog.TranslogHeader
protected
-
Constructor Summary
ConstructorDescriptionBaseTranslogReader(long generation, channel, path, org.elasticsearch.index.translog.TranslogHeader header)
-
Method Summary
Modifier and TypeMethodDescriptionprotected BufferedChecksumStreamInput
reusableBuffer, long position, int opSize, BufferedChecksumStreamInput reuse)
reads an operation at the given position and returns it.int
long
long
long
long
Returns the primary term associated with this translog reader.org.elasticsearch.index.translog.TranslogSnapshot
path()
protected Translog.Operation
read(BufferedChecksumStreamInput inStream)
protected abstract void
buffer, long position)
reads bytes at position into the given buffer, filling it.protected int
reusableBuffer, long position)
read the size of the op (i.e., number of bytes, including the op size) written at the given positionabstract long
toString()
abstract int
Methods inherited from class java.lang.
, , , , , , , , ,
-
Field Details
-
generation
protected final long generation -
channel
protected final channel -
path
protected final path -
header
protected final org.elasticsearch.index.translog.TranslogHeader header
-
-
Constructor Details
-
BaseTranslogReader
public BaseTranslogReader(long generation, channel, path, org.elasticsearch.index.translog.TranslogHeader header)
-
-
Method Details
-
getGeneration
public long getGeneration() -
sizeInBytes
public abstract long sizeInBytes() -
totalOperations
public abstract int totalOperations() -
getFirstOperationOffset
public final long getFirstOperationOffset() -
getPrimaryTerm
public final long getPrimaryTerm()Returns the primary term associated with this translog reader. -
readSize
protected final int readSize( reusableBuffer, long position) throwsread the size of the op (i.e., number of bytes, including the op size) written at the given position- Throws:
-
newSnapshot
public org.elasticsearch.index.translog.TranslogSnapshot newSnapshot() -
checksummedStream
protected final reusableBuffer, long position, int opSize, BufferedChecksumStreamInput reuse) throwsreads an operation at the given position and returns it. The buffer length is equal to the number of bytes reads.- Throws:
-
read
- Throws:
-
readBytes
protected abstract void readBytes( buffer, long position) throwsreads bytes at position into the given buffer, filling it.- Throws:
-
toString
public toString()- Overrides:
in class
-
compareTo
- Specified by:
in interface
<BaseTranslogReader>
-
path
public path() -
getLastModifiedTime
public long getLastModifiedTime() throws- Throws:
-