Class Splitter

java.lang.Object
org.apache.cassandra.dht.Splitter

public abstract class Splitter extends Object
Partition splitter.
  • Constructor Details

  • Method Details

    • tokenForValue

      protected abstract Token tokenForValue(BigInteger value)
    • valueForToken

      protected abstract BigInteger valueForToken(Token token)
    • tokensInRange

      protected BigInteger tokensInRange(Range<Token> range)
    • elapsedTokens

      protected BigInteger elapsedTokens(Token token, Range<Token> range)
      Computes the number of elapsed tokens from the range start until this token
      Returns:
      the number of tokens from the range start to the token
    • positionInRange

      public double positionInRange(Token token, Range<Token> range)
      Computes the normalized position of this token relative to this range
      Returns:
      A number between 0.0 and 1.0 representing this token's position in this range or -1.0 if this range doesn't contain this token.
    • splitOwnedRanges

      public List<Token> splitOwnedRanges(int parts, List<Splitter.WeightedRange> weightedRanges, boolean dontSplitRanges)
    • split

      public Set<Range<Token>> split(Collection<Range<Token>> ranges, int parts)
      Splits the specified token ranges in at least parts subranges.

      Each returned subrange will be contained in exactly one of the specified ranges.

      Parameters:
      ranges - a collection of token ranges to be split
      parts - the minimum number of returned ranges
      Returns:
      at least minParts token ranges covering ranges