Skip to content

Commit f2867df

Browse files
mark older LeastShardAllocationStrategy as obsolete (#6975)
* mark older LeastShardAllocationStrategy as obsolete * added API approvals
1 parent 1f868e0 commit f2867df

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/contrib/cluster/Akka.Cluster.Sharding/ClusterSharding.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1415,10 +1415,13 @@ public IShardAllocationStrategy DefaultShardAllocationStrategy(ClusterShardingSe
14151415
}
14161416
else
14171417
{
1418+
// TODO: remove this in v1.6 and force all users to use only the new strategy going forward
14181419
// old algorithm
14191420
var threshold = settings.TuningParameters.LeastShardAllocationRebalanceThreshold;
14201421
var maxSimultaneousRebalance = settings.TuningParameters.LeastShardAllocationMaxSimultaneousRebalance;
1422+
#pragma warning disable CS0618 // Type or member is obsolete
14211423
return new LeastShardAllocationStrategy(threshold, maxSimultaneousRebalance);
1424+
#pragma warning restore CS0618 // Type or member is obsolete
14221425
}
14231426
}
14241427
}

src/contrib/cluster/Akka.Cluster.Sharding/ShardAllocationStrategy.cs

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public static IShardAllocationStrategy LeastShardAllocationStrategy(int absolute
139139
/// The number of ongoing rebalancing processes can be limited by `maxSimultaneousRebalance`.
140140
/// </summary>
141141
[Serializable]
142+
[Obsolete("Use ShardAllocationStrategy.LeastShardAllocationStrategy instead. This will be removed in v1.6.")]
142143
public class LeastShardAllocationStrategy : AbstractLeastShardAllocationStrategy
143144
{
144145
private readonly int _rebalanceThreshold;

src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveClusterSharding.DotNet.verified.txt

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ namespace Akka.Cluster.Sharding
180180
{
181181
void Start();
182182
}
183+
[System.ObsoleteAttribute("Use ShardAllocationStrategy.LeastShardAllocationStrategy instead. This will be re" +
184+
"moved in v1.6.")]
183185
public class LeastShardAllocationStrategy : Akka.Cluster.Sharding.Internal.AbstractLeastShardAllocationStrategy
184186
{
185187
public LeastShardAllocationStrategy(int rebalanceThreshold, int maxSimultaneousRebalance) { }

src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveClusterSharding.Net.verified.txt

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ namespace Akka.Cluster.Sharding
180180
{
181181
void Start();
182182
}
183+
[System.ObsoleteAttribute("Use ShardAllocationStrategy.LeastShardAllocationStrategy instead. This will be re" +
184+
"moved in v1.6.")]
183185
public class LeastShardAllocationStrategy : Akka.Cluster.Sharding.Internal.AbstractLeastShardAllocationStrategy
184186
{
185187
public LeastShardAllocationStrategy(int rebalanceThreshold, int maxSimultaneousRebalance) { }

0 commit comments

Comments
 (0)