Exemplo n.º 1
0
 /** Add new partitions to create a new hashinator configuration. */
 public static byte[] addPartitions(Map<Long, Integer> tokensToPartitions) {
   HashinatorType type = getConfiguredHashinatorType();
   switch (type) {
     case LEGACY:
       throw new RuntimeException("Legacy hashinator doesn't support adding partitions");
     case ELASTIC:
       return ElasticHashinator.addPartitions(instance.get().getSecond(), tokensToPartitions);
   }
   throw new RuntimeException("Should not reach here");
 }
Exemplo n.º 2
0
 /**
  * Get a basic configuration for the currently selected hashinator type based on the current
  * partition count. If Elastic is in play
  */
 public static byte[] getConfigureBytes(int partitionCount) {
   HashinatorType type = getConfiguredHashinatorType();
   switch (type) {
     case LEGACY:
       return LegacyHashinator.getConfigureBytes(partitionCount);
     case ELASTIC:
       return ElasticHashinator.getConfigureBytes(
           partitionCount, ElasticHashinator.DEFAULT_TOKENS_PER_PARTITION);
   }
   throw new RuntimeException("Should not reach here");
 }