Class MultiMutationResponse
- java.lang.Object
-
- com.couchbase.client.core.message.AbstractCouchbaseResponse
-
- com.couchbase.client.core.message.kv.AbstractKeyValueResponse
-
- com.couchbase.client.core.message.kv.subdoc.multi.MultiMutationResponse
-
- All Implemented Interfaces:
CouchbaseMessage
,CouchbaseResponse
,BinaryResponse
,ReferenceCounted
@Committed @Public public class MultiMutationResponse extends AbstractKeyValueResponse
The response for aBinarySubdocMultiMutationRequest
. Error status other thanResponseStatus.SUBDOC_MULTI_PATH_FAILURE
denote an error at document level, while the later denotes an error at sub-document level. In this case, look atfirstErrorStatus()
to determine which sub-document error happened.- Since:
- 1.2
- Author:
- Simon Baslé
-
-
Constructor Summary
Constructors Constructor Description MultiMutationResponse(ResponseStatus status, short serverStatusCode, String bucket, int firstErrorIndex, short firstErrorStatusCode, BinarySubdocMultiMutationRequest request, long cas, MutationToken mutationToken)
Creates aMultiMutationResponse
that failed at subdocument level.MultiMutationResponse(ResponseStatus status, short serverStatusCode, String bucket, BinarySubdocMultiMutationRequest request, long cas, MutationToken mutationToken)
Creates a unsuccessfulMultiMutationResponse
that failed at document level.MultiMutationResponse(String bucket, BinarySubdocMultiMutationRequest request, long cas, MutationToken token, List<MultiResult<Mutation>> responses)
Creates an successfulMultiMutationResponse
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
cas()
int
firstErrorIndex()
ResponseStatus
firstErrorStatus()
MutationToken
mutationToken()
BinarySubdocMultiMutationRequest
request()
Stub method implementation which needs to be overridden by all responses that support cloning.List<MultiResult<Mutation>>
responses()
-
Methods inherited from class com.couchbase.client.core.message.kv.AbstractKeyValueResponse
bucket, content, refCnt, release, release, retain, retain, serverDuration, serverDuration, serverStatusCode, toString, touch, touch
-
Methods inherited from class com.couchbase.client.core.message.AbstractCouchbaseResponse
creationTime, status, statusDetails, statusDetails
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseMessage
creationTime
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseResponse
status, statusDetails, statusDetails
-
-
-
-
Constructor Detail
-
MultiMutationResponse
public MultiMutationResponse(ResponseStatus status, short serverStatusCode, String bucket, int firstErrorIndex, short firstErrorStatusCode, BinarySubdocMultiMutationRequest request, long cas, MutationToken mutationToken)
Creates aMultiMutationResponse
that failed at subdocument level. The status, expected to beResponseStatus.SUBDOC_MULTI_PATH_FAILURE
, denotes that at least oneMutationCommand
failed.- Parameters:
status
- the status of the request (SUBDOC_MULTI_PATH_FAILURE).serverStatusCode
- the status code of the whole request.bucket
- the bucket on which the request happened.firstErrorIndex
- the zero-based index of the firstMutationCommand
that failed (in case failure is due to one or more commands).firstErrorStatusCode
- the status code for the firstMutationCommand
that failed (in case failure is due to one or more commands).request
- the originalBinarySubdocMultiMutationRequest
.cas
- the CAS value of the document after mutations.mutationToken
- theMutationToken
of the document after mutations, if available. Null otherwise.
-
MultiMutationResponse
public MultiMutationResponse(ResponseStatus status, short serverStatusCode, String bucket, BinarySubdocMultiMutationRequest request, long cas, MutationToken mutationToken)
Creates a unsuccessfulMultiMutationResponse
that failed at document level. First error index is set to -1 and first error status is set toResponseStatus.FAILURE
.- Parameters:
status
- the failed status of the request.serverStatusCode
- the status code of the whole request.bucket
- the bucket on which the request happened.request
- the originalBinarySubdocMultiMutationRequest
.cas
- the CAS value of the document after mutations.mutationToken
- theMutationToken
of the document after mutations, if available. Null otherwise.
-
MultiMutationResponse
public MultiMutationResponse(String bucket, BinarySubdocMultiMutationRequest request, long cas, MutationToken token, List<MultiResult<Mutation>> responses)
Creates an successfulMultiMutationResponse
.- Parameters:
bucket
- the bucket on which the request happened.request
- the originalBinarySubdocMultiMutationRequest
.cas
- the CAS value of the document after mutations.token
- theMutationToken
of the document after mutations, if available. Null otherwise.responses
- the list ofMultiResult<Mutation>
for each command. Some may include a value.
-
-
Method Detail
-
request
public BinarySubdocMultiMutationRequest request()
Description copied from class:AbstractCouchbaseResponse
Stub method implementation which needs to be overridden by all responses that support cloning.- Specified by:
request
in interfaceCouchbaseResponse
- Overrides:
request
in classAbstractCouchbaseResponse
- Returns:
- a fresh request.
-
cas
public long cas()
- Returns:
- the CAS value of the whole document in case a mutation was applied.
-
mutationToken
public MutationToken mutationToken()
- Returns:
- the
MutationToken
corresponding to a mutation of the document, if it was mutated and tokens are activated.
-
firstErrorIndex
public int firstErrorIndex()
- Returns:
- the zero-based index of the first
MutationCommand
that failed, or -1 if none failed or the whole request failed due to another factor (eg. key doesn't exist).
-
firstErrorStatus
public ResponseStatus firstErrorStatus()
- Returns:
- the
ResponseStatus
of the firstMutationCommand
that failed,ResponseStatus.SUCCESS
if none failed orResponseStatus.FAILURE
if the whole request failed due to another factor (eg. key doesn't exist).
-
responses
public List<MultiResult<Mutation>> responses()
- Returns:
- a list of
MultiResult<Mutation>
, giving the individual result of eachMutationCommand
.
-
-