Package io.debezium.crdt
Class CRDT
java.lang.Object
io.debezium.crdt.CRDT
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic DeltaCounter
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
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.
-
Constructor Details
-
CRDT
private CRDT()
-
-
Method Details
-
newGCounter
Create a new CRDT grow-only (G) counter. The operations on this counter are not threadsafe.- Returns:
- the new counter; never null
-
newGCounter
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
Create a new CRDT positive and negative (PN) counter. The operations on this counter are not threadsafe.- Returns:
- the new counter; never null
-
newPNCounter
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
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
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
-