Package io.debezium.crdt
Interface PNCounter
-
- All Known Subinterfaces:
DeltaCounter
- All Known Implementing Classes:
StateBasedPNCounter
,StateBasedPNDeltaCounter
@NotThreadSafe public interface PNCounter extends PNCount, GCounter
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 bymerging
all the replicated instances, without regard to order of merging.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PNCounter
decrement()
Decrement the counter and get the result.long
decrementAndGet()
Decrement the counter and get the result.long
getAndDecrement()
Decrement the counter and get the result.PNCounter
increment()
Increment the counter and get the result.PNCounter
merge(Count other)
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 Detail
-
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
-
-