Package io.camunda.zeebe.journal.record
Interface JournalRecordSerializer
- All Known Implementing Classes:
SBESerializer
public interface JournalRecordSerializer
-
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) default Either<BufferOverflowException,Integer> writeData(RecordData record, org.agrona.MutableDirectBuffer buffer, int offset) Writes aRecordDatato the buffer.intwriteMetadata(RecordMetadata metadata, org.agrona.MutableDirectBuffer buffer, int offset) Writes aRecordMetadatato the buffer.
-
Method Details
-
writeData
default Either<BufferOverflowException,Integer> writeData(RecordData record, org.agrona.MutableDirectBuffer buffer, int offset) Writes aRecordDatato the buffer.- Parameters:
record- to writebuffer- to which the record will be writtenoffset- 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
Writes aRecordMetadatato the buffer.- 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
int getMetadataLength()Returns the number of bytes required to write aRecordMetadatato a buffer. The length returned by this method must be equal to the length returned bywriteMetadata(RecordMetadata, MutableDirectBuffer, int)- Returns:
- the expected length of a serialized metadata
-
readMetadata
Reads theRecordMetadatafrom the buffer at offset 0. A valid record must exist in the buffer at this position.- 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
Reads theRecordDatafrom the buffer at offset 0. A valid record must exist in the buffer at this position.- 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
int getMetadataLength(org.agrona.DirectBuffer buffer, int offset) Returns the length of the serializedRecordMetadatain the buffer.- Parameters:
buffer- to readoffset- the offset in the buffer at which the metadata will be read from- Returns:
- the length of the metadata
-