Class AbstractLeastShardAllocationStrategy
Common logic for the least shard allocation strategy implementations
Inheritance
AbstractLeastShardAllocationStrategy
Assembly: Akka.Cluster.Sharding.dll
Syntax
public abstract class AbstractLeastShardAllocationStrategy : IActorSystemDependentAllocationStrategy, IShardAllocationStrategy, INoSerializationVerificationNeeded
Properties
|
Edit this page
View Source
ClusterState
Declaration
protected virtual ClusterEvent.CurrentClusterState ClusterState { get; }
Property Value
|
Edit this page
View Source
SelfMember
Declaration
protected virtual Member SelfMember { get; }
Property Value
Methods
|
Edit this page
View Source
AllocateShard(IActorRef, string, IImmutableDictionary<IActorRef, IImmutableList<string>>)
Invoked when the location of a new shard is to be decided.
Declaration
public Task<IActorRef> AllocateShard(IActorRef requester, string shardId, IImmutableDictionary<IActorRef, IImmutableList<string>> currentShardAllocations)
Parameters
Type |
Name |
Description |
IActorRef |
requester |
Actor reference to the ShardRegion that requested the location of the shard, can be returned
if preference should be given to the node where the shard was first accessed.
|
string |
shardId |
The id of the shard to allocate.
|
IImmutableDictionary<IActorRef, IImmutableList<string>> |
currentShardAllocations |
All actor refs to ShardRegion and their current allocated shards, in the order they were allocated
|
Returns
Type |
Description |
Task<IActorRef> |
Task of the actor ref of the ShardRegion that is to be responsible for the shard,
must be one of the references included in the currentShardAllocations parameter.
|
|
Edit this page
View Source
IsAGoodTimeToRebalance(IEnumerable<RegionEntry>)
Declaration
protected bool IsAGoodTimeToRebalance(IEnumerable<AbstractLeastShardAllocationStrategy.RegionEntry> regionEntries)
Parameters
Returns
|
Edit this page
View Source
MostSuitableRegion(IEnumerable<RegionEntry>)
Declaration
protected (IActorRef Region, IImmutableList<string> Shards) MostSuitableRegion(IEnumerable<AbstractLeastShardAllocationStrategy.RegionEntry> regionEntries)
Parameters
Returns
|
Edit this page
View Source
Rebalance(IImmutableDictionary<IActorRef, IImmutableList<string>>, IImmutableSet<string>)
Invoked periodically to decide which shards to rebalance to another location.
Declaration
public abstract Task<IImmutableSet<string>> Rebalance(IImmutableDictionary<IActorRef, IImmutableList<string>> currentShardAllocations, IImmutableSet<string> rebalanceInProgress)
Parameters
Returns
|
Edit this page
View Source
RegionEntriesFor(IImmutableDictionary<IActorRef, IImmutableList<string>>)
Declaration
protected ImmutableList<AbstractLeastShardAllocationStrategy.RegionEntry> RegionEntriesFor(IImmutableDictionary<IActorRef, IImmutableList<string>> currentShardAllocations)
Parameters
Returns
|
Edit this page
View Source
Start(ActorSystem)
Called before any calls to allocate/rebalance.
Do not block. If asynchronous actions are required they can be started here and
delay the Futures returned by allocate/rebalance.
Declaration
public void Start(ActorSystem system)
Parameters
Implements
Extension Methods