Package com.yahoo.vdslib
Class BucketDistribution
java.lang.Object
com.yahoo.vdslib.BucketDistribution
- Author:
- Simon Thoresen Hult
-
Constructor Summary
ConstructorsConstructorDescriptionBucketDistribution(int numColumns, int numBucketBits) Constructs a new bucket distribution object with a given number of columns and buckets. -
Method Summary
Modifier and TypeMethodDescriptionintgetColumn(com.yahoo.document.BucketId bucketId) This method maps the given bucket id to its corresponding column.intReturns the number of buckets available using the configured number of bucket bits.intReturns the number of columns to distribute to.voidreset()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.voidsetNumColumns(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.
-
-
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.
-
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(com.yahoo.document.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.
-