diff --git a/io/aerospike/xdr/parser.go b/io/aerospike/xdr/parser.go index 6f02bdfa..bf1bced4 100644 --- a/io/aerospike/xdr/parser.go +++ b/io/aerospike/xdr/parser.go @@ -34,6 +34,58 @@ const ( setNameMRT = "= old, good for restore + AS_MSG_INFO2_GENERATION_GT // 8 + + // AS_MSG_INFO2_DURABLE_DELETE - Op resulting in record deletion leaves tombstone (enterprise only) + AS_MSG_INFO2_DURABLE_DELETE // 16 + + // AS_MSG_INFO2_CREATE_ONLY - Write record only if it doesn't exist + AS_MSG_INFO2_CREATE_ONLY // 32 + + // Bit 64 is unused + _ = 1 << 6 // 64 + + // AS_MSG_INFO2_RESPOND_ALL_OPS - All bin ops (read, write, or modify) require a response, in request order + AS_MSG_INFO2_RESPOND_ALL_OPS // 128 +) + const ( AckOK = 0 AckRetry = 11 @@ -246,7 +298,13 @@ func NewPayload(body []byte) []byte { // ResetXDRBit nullify xdr bit from Info1 field of AerospikeMessage. // Receives body without a header. func ResetXDRBit(message []byte) []byte { - message[1] = 0 + message[1] = message[1] & ^byte(AS_MSG_INFO1_XDR) + return message +} + +// SetGenerationBit set info2 field to 8, which means apply write if new generation >= old. +func SetGenerationBit(message []byte) []byte { + message[2] = message[2] | AS_MSG_INFO2_GENERATION_GT return message }