Package org.elasticsearch.index.translog
Class TranslogReader
java.lang.Object
org.elasticsearch.index.translog.BaseTranslogReader
org.elasticsearch.index.translog.TranslogReader
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Comparable<BaseTranslogReader>
an immutable translog filereader
- 
Field SummaryFieldsFields inherited from class org.elasticsearch.index.translog.BaseTranslogReaderchannel, generation, header, path
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()protected voidprotected booleanisClosed()static TranslogReaderopen(FileChannel channel, Path path, org.elasticsearch.index.translog.Checkpoint checkpoint, String translogUUID)Given a file channel, opens aTranslogReader, taking care of checking and validating the file header.protected voidreadBytes(ByteBuffer buffer, long position)reads an operation at the given position into the given buffer.longintMethods inherited from class org.elasticsearch.index.translog.BaseTranslogReaderchecksummedStream, compareTo, getFirstOperationOffset, getGeneration, getLastModifiedTime, getPrimaryTerm, newSnapshot, path, read, readSize, toString
- 
Field Details- 
lengthprotected final long length
- 
closed
 
- 
- 
Method Details- 
openpublic static TranslogReader open(FileChannel channel, Path path, org.elasticsearch.index.translog.Checkpoint checkpoint, String translogUUID) throws IOExceptionGiven a file channel, opens aTranslogReader, taking care of checking and validating the file header.- Parameters:
- channel- the translog file channel
- path- the path to the translog
- checkpoint- the translog checkpoint
- translogUUID- the tranlog UUID
- Returns:
- a new TranslogReader
- Throws:
- IOException- if any of the file operations resulted in an I/O exception
 
- 
sizeInBytespublic long sizeInBytes()- Specified by:
- sizeInBytesin class- BaseTranslogReader
 
- 
totalOperationspublic int totalOperations()- Specified by:
- totalOperationsin class- BaseTranslogReader
 
- 
readBytesreads an operation at the given position into the given buffer.- Specified by:
- readBytesin class- BaseTranslogReader
- Throws:
- IOException
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
isClosedprotected final boolean isClosed()
- 
ensureOpenprotected void ensureOpen()
 
-