Package com.couchbase.client.core.msg.kv
Class MutationTokenAggregator
java.lang.Object
com.couchbase.client.core.msg.kv.MutationTokenAggregator
- All Implemented Interfaces:
Iterable<MutationToken>
@Internal public class MutationTokenAggregator extends Object implements Iterable<MutationToken>
Helper class that language-specific clients may use to implement
MutationState
.
Holds a set of tokens. Guarantees no two tokens are for the same bucket and partition. Knows how to export the tokens for N1QL and FTS queries.
Thread-safe.
-
Constructor Summary
Constructors Constructor Description MutationTokenAggregator()
-
Method Summary
Modifier and Type Method Description void
add(MutationToken token)
Adds the token to the aggregator, unless there's already a token with the same bucket name and partition and a higher sequence number.boolean
equals(Object o)
Map<String,?>
export()
Exports the tokens into a universal format.Map<String,?>
exportForSearch()
Exports the tokens into a format recognized by the FTS search engine.static MutationTokenAggregator
from(Map<String,?> source)
Parses the serialized form returned byexport()
int
hashCode()
Iterator<MutationToken>
iterator()
String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MutationTokenAggregator
public MutationTokenAggregator()
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<MutationToken>
-
toString
-
add
Adds the token to the aggregator, unless there's already a token with the same bucket name and partition and a higher sequence number. -
export
Exports the tokens into a universal format.The result can be serialized into a N1QL query, or to sent over the network to a different application/SDK to be reconstructed by
from(Map)
.- Returns:
- A map containing only Strings and boxed primitives.
-
exportForSearch
Exports the tokens into a format recognized by the FTS search engine.- Returns:
- A map containing only Strings and boxed primitives.
-
from
Parses the serialized form returned byexport()
-
equals
-
hashCode
public int hashCode()
-