Details
Description
After discussions with the SDK team, we have decided to change the encoding of multi-path mutation responses to include a result body.
The rationale for this is to more correctly support the existing SUBDOC_COUNTER command when part of a multi-path mutation, and to allow future enhancements to subdoc (such as other value-returning mutations - maybe POP) without having to change the binary protocol.
Currently, no value is returned for multi-path mutations - on success you get an empty body, on failure you get a body containing the
{status, index}of the first failed path.
Instead, we will adjust the return value from multi_mutation to consist of a variable number of multi_mutation_result_spec_s:
- On failure, exactly one result_spec is returned (3 bytes):
struct {
uint8_t index;
uint16_t status;
} __attribute__((packed));
(Note the index and status order is flipped, compared to the existing encoding).
- On success, zero to N result_specs are returned, one for each multi-path mutation which returns a value. Each is at least 7 bytes, plus the resultlen:
struct {
uint8_t index;
uint16_t status;
uint32_t resultlen;
uint8_t result[resultlen];
} __attribute__((packed));
See protocol spec (https://docs.google.com/document/d/1A7BVqLGaQurK0lb16-1LiRfViMfsvUcw0lgaMK7anIk/edit#) for full details.