Interface GCounter

All Superinterfaces:
Count, GCount
All Known Subinterfaces:
DeltaCounter, PNCounter
All Known Implementing Classes:
StateBasedGCounter, StateBasedPNCounter, StateBasedPNDeltaCounter

@NotThreadSafe public interface GCounter extends GCount
A simple grow-only counter that maintains a single changing value by tracking the positive changes to the value. It is inspired by the conflict-free replicated data type (CRDT) G Counter.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Increment the counter and get the result.
    Increment the counter and get the result.
    long
    Increment the counter and get the result.
    merge(Count other)
    Merge the supplied counter into this counter.

    Methods inherited from interface io.debezium.crdt.Count

    get

    Methods inherited from interface io.debezium.crdt.GCount

    getIncrement
  • Method Details

    • increment

      GCounter increment()
      Increment the counter and get the result.
      Returns:
      this instance so methods can be chained together; never null
    • incrementAndGet

      long incrementAndGet()
      Increment the counter and get the result.
      Returns:
      the current result after incrementing
    • getAndIncrement

      long getAndIncrement()
      Increment the counter and get the result.
      Returns:
      the current result before incrementing
    • merge

      GCounter merge(Count other)
      Merge the supplied counter into this counter.
      Parameters:
      other - the other counter to merge into this one; may be null
      Returns:
      this counter so that methods can be chained