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, toString
protected 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.IOException
public long sizeInBytes()
sizeInBytes
in class BaseTranslogReader
public int totalOperations()
totalOperations
in class BaseTranslogReader
protected void readBytes(java.nio.ByteBuffer buffer, long position) throws java.io.IOException
readBytes
in class BaseTranslogReader
java.io.IOException
public org.elasticsearch.index.translog.Checkpoint getInfo()
public final void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
protected final boolean isClosed()
protected void ensureOpen()