Package io.debezium.crdt
Interface PNCounter
- All Known Subinterfaces:
DeltaCounter
- All Known Implementing Classes:
StateBasedPNCounter
,StateBasedPNDeltaCounter
A simple counter that maintains a single changing value by separately tracking the positive and negative changes. It is
inspired by the conflict-free replicated data type (CRDT) P-N Counter. The semantics ensure the value converges toward the
global number of increments minus the number of decrements. The global total can be calculated by
merging
all the replicated instances, without regard to order of merging.-
Method Summary
Modifier and TypeMethodDescriptionDecrement the counter and get the result.long
Decrement the counter and get the result.long
Decrement the counter and get the result.Increment the counter and get the result.Merge the supplied counter into this counter.Methods inherited from interface io.debezium.crdt.GCount
getIncrement
Methods inherited from interface io.debezium.crdt.GCounter
getAndIncrement, incrementAndGet
Methods inherited from interface io.debezium.crdt.PNCount
get, getDecrement
-
Method Details
-
increment
PNCounter increment()Increment the counter and get the result. -
decrement
PNCounter decrement()Decrement the counter and get the result.- Returns:
- this instance so methods can be chained together; never null
-
decrementAndGet
long decrementAndGet()Decrement the counter and get the result.- Returns:
- the current result after decrementing
-
getAndDecrement
long getAndDecrement()Decrement the counter and get the result.- Returns:
- the current result before decrementing
-
merge
Merge the supplied counter into this counter.
-