Class DistributedData
Akka extension for convenient configuration and use of the
Akka.DistributedData.Replicator. Configuration settings are defined in the
akka.cluster.ddata
section, see reference.conf
.
Implements
Inherited Members
Namespace: Akka.DistributedData
Assembly: Akka.DistributedData.dll
Syntax
public class DistributedData : IExtension
Constructors
| Improve this Doc View SourceDistributedData(ExtendedActorSystem)
TBD
Declaration
public DistributedData(ExtendedActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ExtendedActorSystem | system | TBD |
Properties
| Improve this Doc View SourceIsDurable
Checks if a durable store for this extension is configured and in use.
Declaration
public bool IsDurable { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsTerminated
Returns true if this member is not tagged with the role configured for the replicas.
Declaration
public bool IsTerminated { get; }
Property Value
Type | Description |
---|---|
Boolean |
Replicator
Actor reference of the Akka.DistributedData.Replicator.
Declaration
public IActorRef Replicator { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Methods
| Improve this Doc View SourceDefaultConfig()
TBD
Declaration
public static Config DefaultConfig()
Returns
Type | Description |
---|---|
Config | TBD |
DeleteAsync<T>(IKey<T>, IWriteConsistency, CancellationToken)
Asynchronously tries to delete a replicated value stored under provided key
within
specified consistency
boundaries. Once deleted, provided key can no longer be used.
As deletion must be remembered, deleted keys will occupy a small portion of memory, producing a garbadge.
If no consistency
will be provided, a WriteLocal will be used.
Keep in mind that failure doesn't mean that delete has failed, only that consistency limits were
not fulfilled. The deletion will be propagated using gossip protocol.
Declaration
public async Task DeleteAsync<T>(IKey<T> key, IWriteConsistency consistency = null, CancellationToken cancellation = default(CancellationToken))
where T : IReplicatedData<T>
Parameters
Type | Name | Description |
---|---|---|
IKey<T> | key | Key under which a replicated data is stored. |
IWriteConsistency | consistency | A consistency level requested for this deletion. |
CancellationToken | cancellation | Cancellation token used to cancel request prematurelly if needed. |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T | Replicated data type to update. |
Exceptions
Type | Condition |
---|---|
TimeoutException | Thrown if update request consistency was not achieved within possible time limit attached to a provided read |
Get(ActorSystem)
TBD
Declaration
public static DistributedData Get(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system | TBD |
Returns
Type | Description |
---|---|
DistributedData | TBD |
GetAsync<T>(IKey<T>, IReadConsistency, CancellationToken)
Asynchronously tries to get a replicated value of type T
stored
under a given key
, while trying to achieve provided read
consistency
. If no value was found under provided key, a null value will be returned.
If no consistency
will be provided, a ReadLocal will be used.
Declaration
public async Task<T> GetAsync<T>(IKey<T> key, IReadConsistency consistency = null, CancellationToken cancellation = default(CancellationToken))
where T : class, IReplicatedData<T>
Parameters
Type | Name | Description |
---|---|---|
IKey<T> | key | Key under which a replicated data is stored. |
IReadConsistency | consistency | A read consistency requested for this write. |
CancellationToken | cancellation | Cancellation token used to cancel request prematurelly if needed. |
Returns
Type | Description |
---|---|
Task<T> | A task which may return a replicated data value or throw an exception. |
Type Parameters
Name | Description |
---|---|
T | Replicated data type to get. |
Exceptions
Type | Condition |
---|---|
DataDeletedException | Thrown if value under provided |
TimeoutException | Thrown if get request consistency was not achieved within possible time limit attached to a provided read |
GetKeysAsync(CancellationToken)
Asynchronously returns list of locally known keys.
Declaration
public async Task<IImmutableSet<string>> GetKeysAsync(CancellationToken cancellation = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellation |
Returns
Type | Description |
---|---|
Task<System.Collections.Immutable.IImmutableSet<String>> |
UpdateAsync<T>(IKey<T>, T, IWriteConsistency, CancellationToken)
Asynchronously tries to update a replicated value stored under provided key
with a replica
value within write consistency
boundaries.
In case of possible conflict a Merge(T) operation will be performed.
If no consistency
will be provided, a WriteLocal will be used.
Keep in mind that failure doesn't mean that write has failed, only that consistency limits were
not fulfilled. The value will be probably further updated as propagated using gossip protocol.
Declaration
public async Task UpdateAsync<T>(IKey<T> key, T replica, IWriteConsistency consistency = null, CancellationToken cancellation = default(CancellationToken))
where T : IReplicatedData<T>
Parameters
Type | Name | Description |
---|---|---|
IKey<T> | key | Key under which a replicated data is stored. |
T | replica | Value used to perform an update. |
IWriteConsistency | consistency | A write consistency requested for this write. |
CancellationToken | cancellation | Cancellation token used to cancel request prematurelly if needed. |
Returns
Type | Description |
---|---|
Task | A task which may complete successfully if update was confirmed within provided consistency or throw an exception. |
Type Parameters
Name | Description |
---|---|
T | Replicated data type to update. |
Exceptions
Type | Condition |
---|---|
DataDeletedException | Thrown if value under provided |
TimeoutException | Thrown if update request consistency was not achieved within possible time limit attached to a provided read |