public class TranslogSnapshot extends BaseTranslogReader implements Translog.Snapshot
Modifier and Type | Field and Description |
---|---|
protected long |
length |
channel, firstOperationOffset, generation, path
Constructor and Description |
---|
TranslogSnapshot(long generation,
java.nio.channels.FileChannel channel,
java.nio.file.Path path,
long firstOperationOffset,
long length,
int totalOperations)
Create a snapshot of translog file channel.
|
Modifier and Type | Method and Description |
---|---|
Translog.Operation |
next()
Returns the next operation in the snapshot or
null if we reached the end. |
protected void |
readBytes(java.nio.ByteBuffer buffer,
long position)
reads an operation at the given position into the given buffer.
|
protected Translog.Operation |
readOperation() |
long |
sizeInBytes() |
java.lang.String |
toString() |
int |
totalOperations()
The total number of operations in the translog.
|
checksummedStream, compareTo, getFirstOperationOffset, getGeneration, newSnapshot, path, read, read, readSize
public TranslogSnapshot(long generation, java.nio.channels.FileChannel channel, java.nio.file.Path path, long firstOperationOffset, long length, int totalOperations)
public final int totalOperations()
Translog.Snapshot
totalOperations
in interface Translog.Snapshot
totalOperations
in class BaseTranslogReader
public Translog.Operation next() throws java.io.IOException
Translog.Snapshot
null
if we reached the end.next
in interface Translog.Snapshot
java.io.IOException
protected final Translog.Operation readOperation() throws java.io.IOException
java.io.IOException
public long sizeInBytes()
sizeInBytes
in class BaseTranslogReader
protected void readBytes(java.nio.ByteBuffer buffer, long position) throws java.io.IOException
readBytes
in class BaseTranslogReader
java.io.IOException
public java.lang.String toString()
toString
in class BaseTranslogReader