java.io.Closeable, java.lang.AutoCloseable, java.lang.Comparable<BaseTranslogReader>public class TranslogReader extends BaseTranslogReader implements java.io.Closeable
| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
closed |
|
protected long |
length |
channel, generation, header, path| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
protected void |
ensureOpen() |
|
protected boolean |
isClosed() |
|
static TranslogReader |
open(java.nio.channels.FileChannel channel,
java.nio.file.Path path,
org.elasticsearch.index.translog.Checkpoint checkpoint,
java.lang.String translogUUID) |
Given a file channel, opens a
TranslogReader, taking care of checking and validating the file header. |
protected void |
readBytes(java.nio.ByteBuffer buffer,
long position) |
reads an operation at the given position into the given buffer.
|
long |
sizeInBytes() |
|
int |
totalOperations() |
checksummedStream, compareTo, getFirstOperationOffset, getGeneration, getLastModifiedTime, getPrimaryTerm, newSnapshot, path, read, readSize, toStringprotected final long length
protected final java.util.concurrent.atomic.AtomicBoolean closed
public static TranslogReader open(java.nio.channels.FileChannel channel, java.nio.file.Path path, org.elasticsearch.index.translog.Checkpoint checkpoint, java.lang.String translogUUID) throws java.io.IOException
TranslogReader, taking care of checking and validating the file header.channel - the translog file channelpath - the path to the translogcheckpoint - the translog checkpointtranslogUUID - the tranlog UUIDjava.io.IOException - if any of the file operations resulted in an I/O exceptionpublic long sizeInBytes()
sizeInBytes in class BaseTranslogReaderpublic int totalOperations()
totalOperations in class BaseTranslogReaderprotected void readBytes(java.nio.ByteBuffer buffer,
long position)
throws java.io.IOException
readBytes in class BaseTranslogReaderjava.io.IOExceptionpublic final void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionprotected final boolean isClosed()
protected void ensureOpen()