Package org.apache.pekko.cluster.ddata
Interface DeltaReplicatedData
-
- All Superinterfaces:
ReplicatedData
- All Known Implementing Classes:
AbstractDeltaReplicatedData
,GCounter
,GSet
,LWWMap
,ORMap
,ORMultiMap
,ORSet
,PNCounter
,PNCounterMap
public interface DeltaReplicatedData extends ReplicatedData
ReplicatedData
with additional support for delta-CRDT replication. delta-CRDT is a way to reduce the need for sending the full state for updates. For example adding element 'c' and 'd' to set {'a', 'b'} would result in sending the delta {'c', 'd'} and merge that with the state on the receiving side, resulting in set {'a', 'b', 'c', 'd'}.Learn more about this in the paper Delta State Replicated Data Types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description scala.Option<ReplicatedDelta>
delta()
The accumulated delta of mutator operations since previousresetDelta()
.DeltaReplicatedData
mergeDelta(DeltaReplicatedData thatDelta)
When delta is merged into the full state this method is used.DeltaReplicatedData
resetDelta()
Reset collection of deltas from mutator operations.-
Methods inherited from interface org.apache.pekko.cluster.ddata.ReplicatedData
merge
-
-
-
-
Method Detail
-
delta
scala.Option<ReplicatedDelta> delta()
The accumulated delta of mutator operations since previousresetDelta()
. When theReplicator
invokes themodify
function of theUpdate
message and the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicator
with thedelta()
accessor. Themodify
function shall still return the full state in the same way asReplicatedData
without support for deltas.
-
mergeDelta
DeltaReplicatedData mergeDelta(DeltaReplicatedData thatDelta)
When delta is merged into the full state this method is used. When the typeD
of the delta is of the same type as the full stateT
this method can be implemented by delegating tomerge
.
-
resetDelta
DeltaReplicatedData resetDelta()
Reset collection of deltas from mutator operations. When theReplicator
invokes themodify
function of theUpdate
message the delta is always "reset" and when the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicator
with thedelta()
accessor. When theReplicator
has grabbed thedelta
it will invoke this method to get a clean data instance without the delta.
-
-