Class BaseTranslogReader

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.nio.channels.FileChannel channel  
      protected long generation  
      protected org.elasticsearch.index.translog.TranslogHeader header  
      protected java.nio.file.Path path  
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseTranslogReader​(long generation, java.nio.channels.FileChannel channel, java.nio.file.Path path, org.elasticsearch.index.translog.TranslogHeader header)  
    • Field Detail

      • generation

        protected final long generation
      • channel

        protected final java.nio.channels.FileChannel channel
      • path

        protected final java.nio.file.Path path
      • header

        protected final org.elasticsearch.index.translog.TranslogHeader header
    • Constructor Detail

      • BaseTranslogReader

        public BaseTranslogReader​(long generation,
                                  java.nio.channels.FileChannel channel,
                                  java.nio.file.Path path,
                                  org.elasticsearch.index.translog.TranslogHeader header)
    • Method Detail

      • getGeneration

        public long getGeneration()
      • sizeInBytes

        public abstract long sizeInBytes()
      • totalOperations

        public abstract int totalOperations()
      • getFirstOperationOffset

        public final long getFirstOperationOffset()
      • getPrimaryTerm

        public final long getPrimaryTerm()
        Returns the primary term associated with this translog reader.
      • readSize

        protected final int readSize​(java.nio.ByteBuffer reusableBuffer,
                                     long position)
                              throws java.io.IOException
        read the size of the op (i.e., number of bytes, including the op size) written at the given position
        Throws:
        java.io.IOException
      • newSnapshot

        public org.elasticsearch.index.translog.TranslogSnapshot newSnapshot()
      • checksummedStream

        protected final BufferedChecksumStreamInput checksummedStream​(java.nio.ByteBuffer reusableBuffer,
                                                                      long position,
                                                                      int opSize,
                                                                      BufferedChecksumStreamInput reuse)
                                                               throws java.io.IOException
        reads an operation at the given position and returns it. The buffer length is equal to the number of bytes reads.
        Throws:
        java.io.IOException
      • readBytes

        protected abstract void readBytes​(java.nio.ByteBuffer buffer,
                                          long position)
                                   throws java.io.IOException
        reads bytes at position into the given buffer, filling it.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • path

        public java.nio.file.Path path()
      • getLastModifiedTime

        public long getLastModifiedTime()
                                 throws java.io.IOException
        Throws:
        java.io.IOException