Package io.camunda.zeebe.journal.record
Class SBESerializer
java.lang.Object
io.camunda.zeebe.journal.record.SBESerializer
- All Implemented Interfaces:
JournalRecordSerializer
The serializer that writes and reads a journal record according to the SBE schema defined.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of bytes required to write aRecordMetadatato a buffer.intgetMetadataLength(org.agrona.DirectBuffer buffer, int offset) Returns the length of the serializedRecordMetadatain the buffer.readData(org.agrona.DirectBuffer buffer, int offset) Reads theRecordDatafrom the buffer at offset 0.readMetadata(org.agrona.DirectBuffer buffer, int offset) Reads theRecordMetadatafrom the buffer at offset 0.writeData(long index, long asqn, BufferWriter recordDataWriter, org.agrona.MutableDirectBuffer writeBuffer, int offset) intwriteMetadata(RecordMetadata metadata, org.agrona.MutableDirectBuffer buffer, int offset) Writes aRecordMetadatato the buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.zeebe.journal.record.JournalRecordSerializer
writeData
-
Constructor Details
-
SBESerializer
public SBESerializer()
-
-
Method Details
-
writeData
public Either<BufferOverflowException,Integer> writeData(long index, long asqn, BufferWriter recordDataWriter, org.agrona.MutableDirectBuffer writeBuffer, int offset) - Specified by:
writeDatain interfaceJournalRecordSerializer
-
writeMetadata
public int writeMetadata(RecordMetadata metadata, org.agrona.MutableDirectBuffer buffer, int offset) Description copied from interface:JournalRecordSerializerWrites aRecordMetadatato the buffer.- Specified by:
writeMetadatain interfaceJournalRecordSerializer- Parameters:
metadata- to writebuffer- to which the metadata will be writtenoffset- the offset in the buffer at which the metadata will be written- Returns:
- the number of bytes that were written to the buffer
-
getMetadataLength
public int getMetadataLength()Description copied from interface:JournalRecordSerializerReturns the number of bytes required to write aRecordMetadatato a buffer. The length returned by this method must be equal to the length returned byJournalRecordSerializer.writeMetadata(RecordMetadata, MutableDirectBuffer, int)- Specified by:
getMetadataLengthin interfaceJournalRecordSerializer- Returns:
- the expected length of a serialized metadata
-
readMetadata
Description copied from interface:JournalRecordSerializerReads theRecordMetadatafrom the buffer at offset 0. A valid record must exist in the buffer at this position.- Specified by:
readMetadatain interfaceJournalRecordSerializer- Parameters:
buffer- to readoffset- the offset in the buffer at which the metadata will be read from- Returns:
- a journal record metadata that is read.
-
readData
Description copied from interface:JournalRecordSerializerReads theRecordDatafrom the buffer at offset 0. A valid record must exist in the buffer at this position.- Specified by:
readDatain interfaceJournalRecordSerializer- Parameters:
buffer- to readoffset- the offset in the buffer at which the data will be read from- Returns:
- a journal indexed record that is read.
-
getMetadataLength
public int getMetadataLength(org.agrona.DirectBuffer buffer, int offset) Description copied from interface:JournalRecordSerializerReturns the length of the serializedRecordMetadatain the buffer.- Specified by:
getMetadataLengthin interfaceJournalRecordSerializer- Parameters:
buffer- to readoffset- the offset in the buffer at which the metadata will be read from- Returns:
- the length of the metadata
-