Interface MutableRecordBatch
- All Superinterfaces:
ImmutableRecordBatch,Iterable<RecordBatchEntry>
- All Known Implementing Classes:
RecordBatch
Represents a modifiable batch of record, which means we can add multiple Records to the batch.
For further processing the user can iterate of the appended entries and retrieve the needed data.
-
Method Summary
Modifier and TypeMethodDescriptionappendRecord(long key, RecordMetadata metadata, int sourceIndex, BufferWriter valueWriter) Allows to add a new Record to the batchbooleancanAppendRecordOfLength(int recordLength) Allows to verify whether the given record length is suitable to be appended in the current batch.Methods inherited from interface io.camunda.zeebe.stream.api.records.ImmutableRecordBatch
entries, isEmptyMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
appendRecord
Either<RuntimeException,Void> appendRecord(long key, RecordMetadata metadata, int sourceIndex, BufferWriter valueWriter) Allows to add a new Record to the batch- Parameters:
key- the key of the recordmetadata- the record's metadatasourceIndex- the position/index in the current batch which caused that entry; should be set to -1 if no entry caused itvalueWriter- the actual record value- Returns:
- either a failure if record can't be added to the batch or null on success
-
canAppendRecordOfLength
boolean canAppendRecordOfLength(int recordLength) Allows to verify whether the given record length is suitable to be appended in the current batch. This method is useful if you have one record which will be updated and you don't want to append it right now, just to verify whether it would still fit.- Parameters:
recordLength- the expected record length, which needs to be verified- Returns:
- true if the record length would fit into the batch, false otherwise
-