Akka.DistributedData Namespace |
Class | Description | |
---|---|---|
Changed |
The data value is retrieved with Data using the typed key.
| |
DataDeleted | ||
DataDeletedException |
TBD
| |
Delete |
Send this message to the local Replicator to delete a data value for the
given Key. The Replicator will reply with one of the [!:IDeleteResponse<T>] messages.
| |
DeleteSuccess | ||
DistributedData |
Akka extension for convenient configuration and use of the
Replicator. Configuration settings are defined in the
`akka.cluster.ddata` section, see `reference.conf`.
| |
DistributedDataExtensions | ||
DistributedDataProvider |
TBD
| |
Dsl |
A helper class used to simplify creation of messages send through
the Replicator.
| |
FastMergeT |
INTERNAL API
Optimization for add/remove followed by merge and merge should just fast forward to
the new instance.
It's like a cache between calls of the same thread, you can think of it as a thread local.
The Replicator actor invokes the user's modify function, which returns a new ReplicatedData instance,
with the ancestor field set (see for example the add method in ORSet). Then (in same thread) the
Replication calls merge, which makes use of the ancestor field to perform quick merge
(see for example merge method in ORSet).
It's not thread safe if the modifying function and merge are called from different threads,
i.e. if used outside the Replicator infrastructure, but the worst thing that can happen is that
a full merge is performed instead of the fast forward merge.
| |
Flag |
Implements a boolean flag CRDT that is initialized to `false` and
can be switched to `true`. `true` wins over `false` in merge.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
FlagKey |
TBD
| |
FlushChanges |
Notify subscribers of changes now, otherwise they will be notified periodically
with the configured `notify-subscribers-interval`.
| |
GCounter |
Implements a 'Growing Counter' CRDT, also called a 'G-Counter'.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
A G-Counter is a increment-only counter (inspired by vector clocks) in
which only increment and merge are possible. Incrementing the counter
adds 1 to the count for the current node. Divergent histories are
resolved by taking the maximum count for each node (like a vector
clock merge). The value of the counter is the sum of all node counts.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
GCounterKey |
TBD
| |
Get |
Send this message to the local Replicator to retrieve a data value for the
given `key`. The `Replicator` will reply with one of the [!:GetResponse] messages.
The optional `request` context is included in the reply messages. This is a convenient
way to pass contextual information (e.g. original sender) without having to use `ask`
or maintain local correlation data structures.
| |
GetFailure |
The GetT(IKeyT) request could not be fulfill according to the given
IReadConsistency level and Timeout timeout.
| |
GetKeyIds | ||
GetKeysIdsResult | ||
GetReplicaCount |
Get current number of replicas, including the local replica.
Will reply to sender with ReplicaCount.
| |
GetSuccess | ||
GSet |
TBD
| |
GSetT |
Implements a 'Add Set' CRDT, also called a 'G-Set'. You can't
remove elements of a G-Set.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
A G-Set doesn't accumulate any garbage apart from the elements themselves.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
GSetKeyT |
TBD
| |
KeyT |
Key for the key-value data in Replicator. The type of the data value
is defined in the key. KeySet are compared equal if the `id` strings are equal,
i.e. use unique identifiers.
Specific classes are provided for the built in data types, e.g. ORSetKeyT,
and you can create your own keys.
| |
LWWDictionary |
TBD
| |
LWWDictionaryTKey, TValue |
Specialized LWWDictionaryTKey, TValue with LWWRegisterT values.
LWWRegisterT relies on synchronized clocks and should only be used when the choice of
value is not important for concurrent updates occurring within the clock skew.
Instead of using timestamps based on DateTime.UtcNow.Ticks time it is possible to
use a timestamp value based on something else, for example an increasing version number
from a database record that is used for optimistic concurrency control.
For first-write-wins semantics you can use the ReverseClock instead of the
DefaultClock
This class is immutable, i.e. "modifying" methods return a new instance.
| |
LWWDictionaryKeyTKey, TValue |
TBD
| |
LWWRegisterT |
Implements a 'Last Writer Wins Register' CRDT, also called a 'LWW-Register'.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
Merge takes the register with highest timestamp. Note that this
relies on synchronized clocks. LWWRegisterT should only be used when the choice of
value is not important for concurrent updates occurring within the clock skew.
Merge takes the register updated by the node with lowest address (UniqueAddress is ordered)
if the timestamps are exactly the same.
Instead of using timestamps based on `DateTime.UtcNow` time it is possible to
use a timestamp value based on something else, for example an increasing version number
from a database record that is used for optimistic concurrency control.
For first-write-wins semantics you can use the ReverseClock instead of the
[[LWWRegister#defaultClock]]
This class is immutable, i.e. "modifying" methods return a new instance.
| |
LWWRegisterKeyT |
TBD
| |
ModifyFailure |
If the `modify` function of the Update throws an exception the reply message
will be this ModifyFailure message. The original exception is included as Cause.
| |
MultiVersionVector | ||
NotFound | ||
ORDictionary | ||
ORDictionaryTKey, TValue |
Implements a 'Observed Remove Map' CRDT, also called a 'OR-Map'.
It has similar semantics as an ORSetT, but in case of concurrent updates
the values are merged, and must therefore be IReplicatedData types themselves.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
ORDictionaryKeyTKey, TValue | ||
ORMultiDictionaryTKey, TValue |
An immutable multi-map implementation. This class wraps an
ORDictionaryTKey, TValue with an ORSetT for the map's value.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
ORMultiDictionaryKeyTKey, TValue | ||
ORSet | ||
ORSetT |
Implements a 'Observed Remove Set' CRDT, also called a 'OR-Set'.
Elements can be added and removed any number of times. Concurrent add wins
over remove.
It is not implemented as in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
This is more space efficient and doesn't accumulate garbage for removed elements.
It is described in the paper
An optimized conflict-free replicated set
The implementation is inspired by the Riak DT
riak_dt_orswot.
The ORSet has a version vector that is incremented when an element is added to
the set. The `node -> count` pair for that increment is stored against the
element as its "birth dot". Every time the element is re-added to the set,
its "birth dot" is updated to that of the `node -> count` version vector entry
resulting from the add. When an element is removed, we simply drop it, no tombstones.
When an element exists in replica A and not replica B, is it because A added
it and B has not yet seen that, or that B removed it and A has not yet seen that?
In this implementation we compare the `dot` of the present element to the version vector
in the Set it is absent from. If the element dot is not "seen" by the Set version vector,
that means the other set has yet to see this add, and the item is in the merged
Set. If the Set version vector dominates the dot, that means the other Set has removed this
element already, and the item is not in the merged Set.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
ORSetKeyT | ||
PNCounter |
Implements a 'Increment/Decrement Counter' CRDT, also called a 'PN-Counter'.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
PN-Counters allow the counter to be incremented by tracking the
increments (P) separate from the decrements (N). Both P and N are represented
as two internal [[GCounter]]s. Merge is handled by merging the internal P and N
counters. The value of the counter is the value of the P _counter minus
the value of the N counter.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
PNCounterDictionaryTKey |
Map of named counters. Specialized ORDictionaryTKey, TValue
with PNCounter values.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
PNCounterDictionaryKeyT | ||
PNCounterKey | ||
PruningState | ||
ReadAll | ||
ReadFrom | ||
ReadLocal | ||
ReadMajority | ||
ReplicaCount |
Current number of replicas. Reply to GetReplicaCount.
| |
ReplicationDeletedFailure | ||
Replicator | ||
ReplicatorSettings | ||
SingleVersionVector | ||
StoreFailure |
The local store or direct replication of the Update could not be fulfill according to
the given IWriteConsistency due to durable store errors. This is
only used for entries that have been configured to be durable.
The Update was still performed in memory locally and possibly replicated to some nodes,
but it might not have been written to durable storage.
It will eventually be disseminated to other replicas, unless the local replica
crashes before it has been able to communicate with other replicas.
| |
Subscribe |
Register a subscriber that will be notified with a [!:Changed<T>] message
when the value of the given Key is changed. Current value is also
sent as a [!:Changed<T>] message to a new subscriber.
Subscribers will be notified periodically with the configured `notify-subscribers-interval`,
and it is also possible to send an explicit `FlushChanges` message to
the Replicator to notify the subscribers immediately.
The subscriber will automatically be unregistered if it is terminated.
If the key is deleted the subscriber is notified with a [!:DataDeleted<T>] message.
| |
Unsubscribe |
Unregister a subscriber.
| |
Update |
Send this message to the local Replicator to update a data value for the
given Key. The Replicator will reply with one of the
[!:IUpdateResponse<T>] messages.
The current data value for the Key is passed as parameter to the Modify function.
It is if there is no value for the Key, and otherwise Request. The function
is supposed to return the new value of the data, which will then be replicated according to
the given IWriteConsistency.
The Modify function is called by the `Replicator` actor and must therefore be a pure
function that only uses the data parameter and stable fields from enclosing scope. It must
for example not access `sender()` reference of an enclosing actor.
| |
UpdateSuccess | ||
UpdateTimeout |
The direct replication of the Update could not be fulfill according to
the given IWriteConsistency level and Timeout.
The Update was still performed locally and possibly replicated to some nodes.
It will eventually be disseminated to other replicas, unless the local replica
crashes before it has been able to communicate with other replicas.
| |
VersionVector |
Representation of a Vector-based clock (counting clock), inspired by Lamport logical clocks.
Based on code from VectorClock.
This class is immutable, i.e. "modifying" methods return a new instance.
| |
WriteAll | ||
WriteLocal | ||
WriteMajority | ||
WriteTo |
Interface | Description | |
---|---|---|
IDeleteResponse |
A response for a possible Delete request message. It can be one of 3 possible cases:
| |
IGetResponse |
Common response interface on GetT(IKeyT) request. It can take one of
the tree possible values:
| |
IKey |
TBD
| |
IKeyT |
TBD
| |
IPruningPhase | ||
IReadConsistency | ||
IRemovedNodePruning | ||
IRemovedNodePruningT | IReplicatedData that has support for pruning of data
belonging to a specific node may implement this interface.
When a node is removed from the cluster these methods will be
used by the Replicator to collapse data from the removed node
into some other node in the cluster.
| |
IReplicatedData | ||
IReplicatedDataT |
Interface for implementing a state based convergent
replicated data type (CvRDT).
ReplicatedData types must be serializable with an Akka
Serializer. It is highly recommended to implement a serializer with
Protobuf or similar. The built in data types are marked with
IReplicatedDataSerialization and serialized with
[!:ReplicatedDataSerializer].
Serialization of the data types are used in remote messages and also
for creating message digests (SHA-1) to detect changes. Therefore it is
important that the serialization produce the same bytes for the same content.
For example sets and maps should be sorted deterministically in the serialization.
ReplicatedData types should be immutable, i.e. "modifying" methods should return
a new instance.
| |
IReplicatedDataSerialization |
TBD
| |
IReplicatorMessage | ||
IUpdateFailure |
A common interface for Update responses that have ended with a failure.
| |
IUpdateResponse |
A response message for the Update request. It can be one of the 3 possible types:
| |
IWriteConsistency |
Delegate | Description | |
---|---|---|
ClockT |
Delegate responsible for managing LWWRegisterT clock.
|
Enumeration | Description | |
---|---|---|
VersionVectorOrdering |