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
ReplicatedDatawith 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().DeltaReplicatedDatamergeDelta(DeltaReplicatedData thatDelta)When delta is merged into the full state this method is used.DeltaReplicatedDataresetDelta()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 theReplicatorinvokes themodifyfunction of theUpdatemessage 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 theReplicatorwith thedelta()accessor. Themodifyfunction shall still return the full state in the same way asReplicatedDatawithout support for deltas.
-
mergeDelta
DeltaReplicatedData mergeDelta(DeltaReplicatedData thatDelta)
When delta is merged into the full state this method is used. When the typeDof the delta is of the same type as the full stateTthis method can be implemented by delegating tomerge.
-
resetDelta
DeltaReplicatedData resetDelta()
Reset collection of deltas from mutator operations. When theReplicatorinvokes themodifyfunction of theUpdatemessage 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 theReplicatorwith thedelta()accessor. When theReplicatorhas grabbed thedeltait will invoke this method to get a clean data instance without the delta.
-
-