From 2e58bae7cf8db90935f3dc123c7c99900ab22a89 Mon Sep 17 00:00:00 2001 From: Ruslans Tarasovs Date: Fri, 13 Oct 2023 13:26:55 +0300 Subject: [PATCH] Add scaladoc for ClusterShardingLocal and DataCenter --- .../cluster/sharding/ClusterShardingLocal.scala | 8 +++++++- .../evolutiongaming/akkaeffect/cluster/DataCenter.scala | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cluster-sharding/src/main/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocal.scala b/cluster-sharding/src/main/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocal.scala index cb155b3d..8eac0eb6 100644 --- a/cluster-sharding/src/main/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocal.scala +++ b/cluster-sharding/src/main/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocal.scala @@ -19,11 +19,17 @@ import scala.concurrent.Promise import scala.concurrent.duration._ import scala.util.Try - +/** Stub for [[ClusterSharding]] to be used in the unit tests. */ trait ClusterShardingLocal[F[_]] { + /** Provides the actual stub */ def clusterSharding: ClusterSharding[F] + /** Simulate cluster rebalacing. + * + * I.e. send `handOffStopMessage` from [[ClusterSharding#startProxy]] to the + * actors that need rebalancing according to `shardAllocationStrategy`. + */ def rebalance: F[Unit] } diff --git a/cluster/src/main/scala/com/evolutiongaming/akkaeffect/cluster/DataCenter.scala b/cluster/src/main/scala/com/evolutiongaming/akkaeffect/cluster/DataCenter.scala index 264b67e4..f30ebeaa 100644 --- a/cluster/src/main/scala/com/evolutiongaming/akkaeffect/cluster/DataCenter.scala +++ b/cluster/src/main/scala/com/evolutiongaming/akkaeffect/cluster/DataCenter.scala @@ -3,7 +3,7 @@ package com.evolutiongaming.akkaeffect.cluster import cats.{Order, Show} import pureconfig.ConfigReader - +/** Datacenter where required cluster singletons are located */ final case class DataCenter(value: String) { override def toString: String = value @@ -16,4 +16,4 @@ object DataCenter { implicit val showDataCenter: Show[DataCenter] = Show.fromToString implicit val configReaderDataCenter: ConfigReader[DataCenter] = ConfigReader[String].map { a => DataCenter(a) } -} \ No newline at end of file +}