All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DirectReader

public interface LogReader extends AutoCloseable
Interface for reading from a bookkeeper entry log.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
     
    int
     
    long
     
    io.netty.buffer.ByteBuf
    readBufferAt(long offset, int size)
    Read a buffer from the file.
    io.netty.buffer.ByteBuf
    readEntryAt(int offset)
    Read an entry at a given offset.
    int
    readIntAt(long offset)
    Read an integer at a given offset.
    void
    readIntoBufferAt(io.netty.buffer.ByteBuf buffer, long offset, int size)
     
    long
    readLongAt(long offset)
    Read an long at a given offset.
  • Method Details

    • logId

      int logId()
      Returns:
      the id of the log being read from.
    • maxOffset

      long maxOffset()
      Returns:
      the maximum offset in the file that can be read from.
    • readBufferAt

      io.netty.buffer.ByteBuf readBufferAt(long offset, int size) throws IOException, EOFException
      Read a buffer from the file. It is the responsibility of the caller to release the returned buffer.
      Parameters:
      offset - the offset to read at
      size - the number of bytes to read
      Returns:
      a bytebuf. The caller must release.
      Throws:
      IOException
      EOFException
    • readIntoBufferAt

      void readIntoBufferAt(io.netty.buffer.ByteBuf buffer, long offset, int size) throws IOException, EOFException
      Throws:
      IOException
      EOFException
    • readIntAt

      int readIntAt(long offset) throws IOException, EOFException
      Read an integer at a given offset.
      Parameters:
      offset - the offset to read from.
      Returns:
      the integer at that offset.
      Throws:
      IOException
      EOFException
    • readLongAt

      long readLongAt(long offset) throws IOException, EOFException
      Read an long at a given offset.
      Parameters:
      offset - the offset to read from.
      Returns:
      the long at that offset.
      Throws:
      IOException
      EOFException
    • readEntryAt

      io.netty.buffer.ByteBuf readEntryAt(int offset) throws IOException, EOFException
      Read an entry at a given offset. The size of the entry must be at (offset - Integer.BYTES). The payload of the entry starts at offset. It is the responsibility of the caller to release the returned buffer.
      Parameters:
      offset - the offset at which to read the entry.
      Returns:
      a bytebuf. The caller must release.
      Throws:
      IOException
      EOFException
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • isClosed

      boolean isClosed()