Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

255 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Versions

From version 2.0.0 this library is based on cats-effect-3. If you want to use it with cats-effect-2, you need to use version prior to 2.0.0, for example, 1.0.7

Sharding Strategies

Build Status Coverage Status Codacy Badge Version License: MIT

Alternative to akka.cluster.sharding.ShardCoordinator.ShardAllocationStrategy

Api

trait ShardingStrategy[F[_]] {

  def allocate(requester: Region, shard: Shard, current: Allocation): F[Option[Region]]

  def rebalance(current: Allocation, inProgress: Set[Shard]): F[List[Shard]]
}

Syntax

val strategy = LeastShardsStrategy()
  .filterShards(...)
  .filterRegions(...)
  .rebalanceThreshold(10)
  .takeShards(10) 
  .shardRebalanceCooldown(1.minute)
  .logging(...)
  .toAllocationStrategy()

Setup

For cats-effect-3

addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")

libraryDependencies += "com.evolutiongaming" %% "sharding-strategy" % "2.0.0"

For cats-effect-2

addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")

libraryDependencies += "com.evolutiongaming" %% "sharding-strategy" % "1.0.7"

About

Custom sharding strategies for akka cluster

Topics

Resources

Contributing

Stars

9 stars

Watchers

10 watching

Forks

Releases

Packages

Used by

Contributors

Languages