Class RecordBatch
java.lang.Object
io.camunda.zeebe.engine.api.records.RecordBatch
- All Implemented Interfaces:
ImmutableRecordBatch
,MutableRecordBatch
,Iterable<ImmutableRecordBatchEntry>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This exception is part of the contract with the engine. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendRecord
(long key, int sourceIndex, RecordType recordType, Intent intent, RejectionType rejectionType, String rejectionReason, ValueType valueType, BufferWriter valueWriter) Allows to add a new Record to the batchboolean
canAppendRecordOfLength
(int recordLength) Allows to verify whether the given record length is suitable to be appended in the current batch.static ImmutableRecordBatch
empty()
void
forEach
(Consumer<? super ImmutableRecordBatchEntry> action) int
iterator()
-
Constructor Details
-
RecordBatch
-
-
Method Details
-
empty
-
appendRecord
public Either<RuntimeException,Void> appendRecord(long key, int sourceIndex, RecordType recordType, Intent intent, RejectionType rejectionType, String rejectionReason, ValueType valueType, BufferWriter valueWriter) Description copied from interface:MutableRecordBatch
Allows to add a new Record to the batch- Specified by:
appendRecord
in interfaceMutableRecordBatch
- Parameters:
key
- the key of the recordsourceIndex
- the position/index in the current batch which caused that entry; should be set to -1 if no entry caused itrecordType
- the type of the record, part of the record metadata, must be setintent
- the intent of the record, part of the record metadata, must be setrejectionType
- the rejection type, part of the record metadata, can be set to a NULL_VALUErejectionReason
- the rejection reason, part of the record metadata, can be emptyvalueType
- the value type, part of the record metadata, must be setvalueWriter
- 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:MutableRecordBatch
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.- Specified by:
canAppendRecordOfLength
in 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:
iterator
in interfaceIterable<ImmutableRecordBatchEntry>
-
forEach
- Specified by:
forEach
in interfaceIterable<ImmutableRecordBatchEntry>
-
spliterator
- Specified by:
spliterator
in interfaceIterable<ImmutableRecordBatchEntry>
-