Mutation state
- class couchbase.mutation_state.MutationState(*docs: MutationResult, **kwargs: Any)
A set of mutation tokens a query, search or range scan is to be consistent with.
Pass it as the
consistent_withoption, and the service waits until it has seen every mutation in the set before it answers.- Parameters:
*docs – Results of mutations whose tokens to add, as
add_results()takes them.**kwargs –
quiet, asadd_results()takes it.
- add_all(bucket: Any, quiet: bool = False) bool
Add every mutation made through a bucket to the set.
- Parameters:
bucket – The bucket the mutations were made through.
quiet – When
True, a bucket with no mutations returnsFalserather than raising.
- Returns:
Trueif at least one mutation was added,Falseif none was andquietwas given.- Return type:
- Raises:
MissingTokenException – If no mutation was added and
quietwas not given.
- add_mutation_token(mut_token: MutationToken | None) None
Add a mutation token to the set.
- Parameters:
mut_token – The token to add. Anything that is not a
MutationTokenis ignored.
- add_results(*rvs: MutationResult, **kwargs: Any) bool
Add the mutation tokens of the given results to the set.
A result carries a token only if mutation tokens are enabled on the connection, as they are by default.
- Parameters:
*rvs – One or more results of mutations.
**kwargs –
quiet: whenTrue, a result with no token stops the adding and returnsFalserather than raising.
- Returns:
Trueif every result’s token was added,Falseif a result had none andquietwas given.- Return type:
- Raises:
MissingTokenException – If no results are given, or a result has no token and
quietwas not given.