Class BucketDistribution

java.lang.Object
com.yahoo.document.BucketDistribution

public class BucketDistribution extends Object
Author:
Simon Thoresen Hult
  • Constructor Summary

    Constructors
    Constructor
    Description
    BucketDistribution(int numColumns, int numBucketBits)
    Constructs a new bucket distribution object with a given number of columns and buckets.
    Constructs a new bucket distribution object as a copy of another.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getColumn(BucketId bucketId)
    This method maps the given bucket id to its corresponding column.
    int
    Returns the number of bits used for bucket identifiers.
    int
    Returns the number of buckets available using the configured number of bucket bits.
    int
    Returns the number of columns to distribute to.
    void
    Sets the number of columns to distribute to to 1, and resets the content of the internal bucket-to-column map so that it all buckets point to that single column.
    void
    setNumBucketBits(int numBucketBits)
    Sets the number of buckets to use for this document distribution object.
    void
    setNumColumns(int numColumns)
    Sets the number of columns to use for this document distribution object.

    Methods inherited from class java.lang.Object

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

    • BucketDistribution

      public BucketDistribution(int numColumns, int numBucketBits)
      Constructs a new bucket distribution object with a given number of columns and buckets.
      Parameters:
      numColumns - The number of columns to distribute to.
      numBucketBits - The number of bits to use for bucket id.
    • BucketDistribution

      public BucketDistribution(BucketDistribution other)
      Constructs a new bucket distribution object as a copy of another.
      Parameters:
      other - The distribution object to copy.
  • Method Details

    • reset

      public void reset()
      Sets the number of columns to distribute to to 1, and resets the content of the internal bucket-to-column map so that it all buckets point to that single column.
    • setNumColumns

      public void setNumColumns(int numColumns)
      Sets the number of columns to use for this document distribution object. This will reset and setup this object from scratch. The original number of buckets is maintained.
      Parameters:
      numColumns - The new number of columns to distribute to.
    • getNumColumns

      public int getNumColumns()
      Returns the number of columns to distribute to.
      Returns:
      The number of columns.
    • setNumBucketBits

      public void setNumBucketBits(int numBucketBits)
      Sets the number of buckets to use for this document distribution object. This will reset and setup this object from scratch. The original number of columns is maintained.
      Parameters:
      numBucketBits - The new number of bits to use for bucket id.
    • getNumBucketBits

      public int getNumBucketBits()
      Returns the number of bits used for bucket identifiers.
      Returns:
      The number of bits.
    • getNumBuckets

      public int getNumBuckets()
      Returns the number of buckets available using the configured number of bucket bits.
      Returns:
      The number of buckets.
    • getColumn

      public int getColumn(BucketId bucketId)
      This method maps the given bucket id to its corresponding column.
      Parameters:
      bucketId - The bucket whose column to lookup.
      Returns:
      The column to distribute the bucket to.