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 implementMutationState
.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
All Methods Static Methods Instance Methods Concrete Methods 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
-
-
-
-
Method Detail
-
iterator
public Iterator<MutationToken> iterator()
- Specified by:
iterator
in interfaceIterable<MutationToken>
-
add
public 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.
-
export
public Map<String,?> 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
public Map<String,?> exportForSearch()
Exports the tokens into a format recognized by the FTS search engine.- Returns:
- A map containing only Strings and boxed primitives.
-
from
public static MutationTokenAggregator from(Map<String,?> source)
Parses the serialized form returned byexport()
-
-