Class CRDT

java.lang.Object
io.debezium.crdt.CRDT

public final class CRDT extends Object
Conflict-free Replicated Data Types (CRDT)s. Unless otherwise noted, the implementations of these interfaces are not thread-safe since they are expected to be used within a thread-safe process, and sent across a network to another thread-safe process where they will be merged together.
Author:
Randall Hauch
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset.
    newDeltaCounter(long totalAdds, long totalRemoves, long recentAdds, long recentRemoves)
    Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset.
    Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset.
    static GCounter
    Create a new CRDT grow-only (G) counter.
    static GCounter
    newGCounter(long adds)
    Create a new CRDT grow-only (G) counter pre-populated with the given value.
    static PNCounter
    Create a new CRDT positive and negative (PN) counter.
    static PNCounter
    newPNCounter(long adds, long removes)
    Create a new CRDT positive and negative (PN) counter pre-populated with the given values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CRDT

      private CRDT()
  • Method Details

    • newGCounter

      public static GCounter newGCounter()
      Create a new CRDT grow-only (G) counter. The operations on this counter are not threadsafe.
      Returns:
      the new counter; never null
    • newGCounter

      public static GCounter newGCounter(long adds)
      Create a new CRDT grow-only (G) counter pre-populated with the given value. The operations on this counter are not threadsafe.
      Parameters:
      adds - the number of adds
      Returns:
      the new counter; never null
    • newPNCounter

      public static PNCounter newPNCounter()
      Create a new CRDT positive and negative (PN) counter. The operations on this counter are not threadsafe.
      Returns:
      the new counter; never null
    • newPNCounter

      public static PNCounter newPNCounter(long adds, long removes)
      Create a new CRDT positive and negative (PN) counter pre-populated with the given values. The operations on this counter are not threadsafe.
      Parameters:
      adds - the number of adds
      removes - the number of removes
      Returns:
      the new counter; never null
    • newDeltaCounter

      public static DeltaCounter newDeltaCounter()
      Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset. The operations on this counter are not threadsafe.
      Returns:
      the new counter; never null
    • newDeltaCounter

      public static DeltaCounter newDeltaCounter(long totalAdds, long totalRemoves, long recentAdds, long recentRemoves)
      Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset. The operations on this counter are not threadsafe.
      Parameters:
      totalAdds - the total number of adds
      totalRemoves - the total number of removes
      recentAdds - the recent number of adds since last DeltaCounter.reset()
      recentRemoves - the recent number of removes since last DeltaCounter.reset()
      Returns:
      the new counter; never null
    • newDeltaCounter

      public static DeltaCounter newDeltaCounter(DeltaCount count)
      Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset. The operations on this counter are not threadsafe.
      Parameters:
      count - the DeltaCount instance that should be used to pre-populate the new counter; may be null
      Returns:
      the new counter; never null