Class RecordBatch
java.lang.Object
io.camunda.zeebe.stream.impl.records.RecordBatch
- All Implemented Interfaces:
ImmutableRecordBatch,MutableRecordBatch,Iterable<RecordBatchEntry>
-
Constructor Summary
Constructors -
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.static ImmutableRecordBatchempty()entries()voidforEach(Consumer<? super RecordBatchEntry> action) intiterator()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.zeebe.stream.api.records.ImmutableRecordBatch
isEmpty
-
Constructor Details
-
RecordBatch
-
-
Method Details
-
empty
-
appendRecord
public Either<RuntimeException,Void> appendRecord(long key, RecordMetadata metadata, int sourceIndex, BufferWriter valueWriter) Description copied from interface:MutableRecordBatchAllows to add a new Record to the batch- Specified by:
appendRecordin interfaceMutableRecordBatch- 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
public boolean canAppendRecordOfLength(int recordLength) Description copied from interface:MutableRecordBatchAllows 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.- Specified by:
canAppendRecordOfLengthin interfaceMutableRecordBatch- Parameters:
recordLength- the expected record length, which needs to be verified- Returns:
- true if the record length would fit into the batch, false otherwise
-
getBatchSize
public int getBatchSize() -
iterator
- Specified by:
iteratorin interfaceIterable<RecordBatchEntry>
-
forEach
- Specified by:
forEachin interfaceIterable<RecordBatchEntry>
-
spliterator
- Specified by:
spliteratorin interfaceIterable<RecordBatchEntry>
-
entries
- Specified by:
entriesin interfaceImmutableRecordBatch
-