Package com.yahoo.document
Class BucketDistribution
java.lang.Object
com.yahoo.document.BucketDistribution
- Author:
- Simon Thoresen Hult
-
Constructor Summary
ConstructorDescriptionBucketDistribution
(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 TypeMethodDescriptionint
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
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.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.
-
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
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
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.
-