public class TranslogReader extends BaseTranslogReader implements java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
closed |
protected long |
length |
channel, firstOperationOffset, generation, path| Constructor and Description |
|---|
TranslogReader(long generation,
java.nio.channels.FileChannel channel,
java.nio.file.Path path,
long firstOperationOffset,
long length,
int totalOperations)
Create a reader of translog file channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
ensureOpen() |
org.elasticsearch.index.translog.Checkpoint |
getInfo() |
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, opens an
TranslogReader, taking 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, newSnapshot, path, read, readSize, toStringprotected final long length
protected final java.util.concurrent.atomic.AtomicBoolean closed
public TranslogReader(long generation,
java.nio.channels.FileChannel channel,
java.nio.file.Path path,
long firstOperationOffset,
long length,
int totalOperations)
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 of checking and validating the file header.java.io.IOExceptionpublic 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 org.elasticsearch.index.translog.Checkpoint getInfo()
public final void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprotected final boolean isClosed()
protected void ensureOpen()