Record Class BatchOperation
- Record Components:
opcode- theMessageTypecode for the individual operationstructureName- the target data structure name (e.g. "users", "order-count")key- operation key (nullable for keyless ops like counter.increment)value- operation value (nullable for read-only or keyless ops)
Each BatchOperation encodes one data-structure command (e.g. MAP_PUT on "users")
together with its key/value payload. A list of these is serialized into a single
MessageType.BATCH_EXECUTE message and sent to the server for execution.
Wire format per operation:
[1 byte opcode] [2 bytes structureNameLen][structureName bytes] [2 bytes keyLen][key bytes] — may be 0 [4 bytes valueLen][value bytes] — may be 0
- Since:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of deserializing a batch — includes flags and the operation list. -
Constructor Summary
ConstructorsConstructorDescriptionBatchOperation(byte opcode, String structureName, byte @Nullable [] key, byte @Nullable [] value) Creates an instance of aBatchOperationrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondeserializeBatch(byte[] data) Deserialize a batch from the message body.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.byte[]key()Returns a clone of the key bytes (defensive copy).static BatchOperationstatic BatchOperationBuild a MAP_PUT batch operation.static BatchOperationmapPutIfAbsent(String mapName, String key, byte[] value) Build a MAP_PUT_IF_ABSENT batch operation.byteopcode()Returns the value of theopcoderecord component.static BatchOperationqueueOffer(String queueName, byte[] value) Build a QUEUE_OFFER batch operation.static byte[]serializeBatch(List<BatchOperation> ops, boolean atomic, boolean replicated) Serialize a list of operations into a byte array for the batch message body.static BatchOperationstatic BatchOperationReturns the value of thestructureNamerecord component.final StringtoString()Returns a string representation of this record class.byte[]value()Returns a clone of the value bytes (defensive copy).
-
Constructor Details
-
BatchOperation
public BatchOperation(byte opcode, String structureName, byte @Nullable [] key, byte @Nullable [] value) Creates an instance of aBatchOperationrecord class.- Parameters:
opcode- the value for theopcoderecord componentstructureName- the value for thestructureNamerecord componentkey- the value for thekeyrecord componentvalue- the value for thevaluerecord component
-
-
Method Details
-
key
public byte[] key()Returns a clone of the key bytes (defensive copy).- Returns:
- cloned key bytes (never null; empty array if not set)
-
value
public byte[] value()Returns a clone of the value bytes (defensive copy).- Returns:
- cloned value bytes (never null; empty array if not set)
-
mapPut
Build a MAP_PUT batch operation.UTF-8 only:
valuebytes must be valid UTF-8. Non-UTF-8 payloads are rejected by the server withRESPONSE_ERROR; use the dedicated single-op map API for binary blobs. -
mapDelete
-
mapPutIfAbsent
Build a MAP_PUT_IF_ABSENT batch operation.UTF-8 only:
valuebytes must be valid UTF-8. Non-UTF-8 payloads are rejected by the server withRESPONSE_ERROR; use the dedicated single-op map API for binary blobs. -
setAdd
-
setRemove
-
queueOffer
Build a QUEUE_OFFER batch operation.UTF-8 only:
valuebytes must be valid UTF-8. Non-UTF-8 payloads are rejected by the server withRESPONSE_ERROR; use the dedicated single-op queue API for binary blobs. -
serializeBatch
Serialize a list of operations into a byte array for the batch message body.Format:
[1 byte flags: bit0=atomic, bit1=replicated] [4 bytes operation count] [operations...]
-
deserializeBatch
Deserialize a batch from the message body.- Returns:
- a
BatchOperation.DeserializedBatchcontaining flags and operations
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
opcode
-
structureName
Returns the value of thestructureNamerecord component.- Returns:
- the value of the
structureNamerecord component
-