Class ShardShuffler

  • Direct Known Subclasses:
    RotationShardShuffler

    public abstract class ShardShuffler
    extends java.lang.Object
    A shuffler for shards whose primary goal is to balance load.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShardShuffler()  
    • Method Summary

      Modifier and Type Method Description
      abstract int nextSeed()
      Return a new seed.
      java.util.List<ShardRouting> shuffle​(java.util.List<ShardRouting> shards)
      Equivalent to calling shuffle(shards, nextSeed()).
      abstract java.util.List<ShardRouting> shuffle​(java.util.List<ShardRouting> shards, int seed)
      Return a shuffled view over the list of shards.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShardShuffler

        public ShardShuffler()
    • Method Detail

      • nextSeed

        public abstract int nextSeed()
        Return a new seed.
      • shuffle

        public abstract java.util.List<ShardRouting> shuffle​(java.util.List<ShardRouting> shards,
                                                             int seed)
        Return a shuffled view over the list of shards. The behavior of this method must be deterministic: if the same list and the same seed are provided twice, then the result needs to be the same.
      • shuffle

        public java.util.List<ShardRouting> shuffle​(java.util.List<ShardRouting> shards)
        Equivalent to calling shuffle(shards, nextSeed()).