Class ModCycle<T extends Number & Comparable<T>>

java.lang.Object
me.ahoo.cosid.sharding.ModCycle<T>
Type Parameters:
T - the type of number that is comparable
All Implemented Interfaces:
PreciseSharding<T>, RangeSharding<T>, Sharding<T>

public class ModCycle<T extends Number & Comparable<T>> extends Object implements Sharding<T>
Modulo-based cyclical sharding algorithm.

Distributes IDs across nodes using modulo arithmetic. Maps a sharding value to a node by computing: value % divisor.

CosIdModShardingAlgorithm

  • Constructor Details

    • ModCycle

      public ModCycle(int divisor, String logicNamePrefix)
      Creates a ModCycle sharding algorithm.
      Parameters:
      divisor - the number of nodes to distribute across
      logicNamePrefix - the prefix for node names
  • Method Details