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 Details

    • MutationTokenAggregator

      public MutationTokenAggregator()
  • Method Details

    • iterator

      public Iterator<MutationToken> iterator()
      Specified by:
      iterator in interface Iterable<MutationToken>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 by export()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object