Interface JournalRecordSerializer

All Known Implementing Classes:
SBESerializer

public interface JournalRecordSerializer
  • Method Details

    • writeData

      default Either<BufferOverflowException,Integer> writeData(RecordData record, org.agrona.MutableDirectBuffer buffer, int offset)
      Writes a RecordData to the buffer.
      Parameters:
      record - to write
      buffer - to which the record will be written
      offset - the offset in the buffer at which the data will be written
      Returns:
      Either an error if there is not enough space or the number of bytes that were written to the buffer
    • writeData

      Either<BufferOverflowException,Integer> writeData(long index, long asqn, BufferWriter recordDataWriter, org.agrona.MutableDirectBuffer writeBuffer, int offset)
    • writeMetadata

      int writeMetadata(RecordMetadata metadata, org.agrona.MutableDirectBuffer buffer, int offset)
      Writes a RecordMetadata to the buffer.
      Parameters:
      metadata - to write
      buffer - to which the metadata will be written
      offset - the offset in the buffer at which the metadata will be written
      Returns:
      the number of bytes that were written to the buffer
    • getMetadataLength

      int getMetadataLength()
      Returns the number of bytes required to write a RecordMetadata to a buffer. The length returned by this method must be equal to the length returned by writeMetadata(RecordMetadata, MutableDirectBuffer, int)
      Returns:
      the expected length of a serialized metadata
    • readMetadata

      RecordMetadata readMetadata(org.agrona.DirectBuffer buffer, int offset)
      Reads the RecordMetadata from the buffer at offset 0. A valid record must exist in the buffer at this position.
      Parameters:
      buffer - to read
      offset - the offset in the buffer at which the metadata will be read from
      Returns:
      a journal record metadata that is read.
    • readData

      RecordData readData(org.agrona.DirectBuffer buffer, int offset)
      Reads the RecordData from the buffer at offset 0. A valid record must exist in the buffer at this position.
      Parameters:
      buffer - to read
      offset - the offset in the buffer at which the data will be read from
      Returns:
      a journal indexed record that is read.
    • getMetadataLength

      int getMetadataLength(org.agrona.DirectBuffer buffer, int offset)
      Returns the length of the serialized RecordMetadata in the buffer.
      Parameters:
      buffer - to read
      offset - the offset in the buffer at which the metadata will be read from
      Returns:
      the length of the metadata