Package io.debezium.crdt
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
CRDT()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DeltaCounter
newDeltaCounter()
Create a new CRDT positive and negative (PN) counter that records how much the value has changed since last reset.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.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.static GCounter
newGCounter()
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
newPNCounter()
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.
-
-
-
Method Detail
-
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 addsremoves
- 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 addstotalRemoves
- the total number of removesrecentAdds
- the recent number of adds since lastDeltaCounter.reset()
recentRemoves
- the recent number of removes since lastDeltaCounter.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
- theDeltaCount
instance that should be used to pre-populate the new counter; may be null- Returns:
- the new counter; never null
-
-