Package com.yahoo.document
Class BucketDistribution
- java.lang.Object
-
- com.yahoo.document.BucketDistribution
-
public class BucketDistribution extends java.lang.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.BucketDistribution(BucketDistribution other)
Constructs a new bucket distribution object as a copy of another.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColumn(BucketId bucketId)
This method maps the given bucket id to its corresponding column.int
getNumBucketBits()
Returns the number of bits used for bucket identifiers.int
getNumBuckets()
Returns the number of buckets available using the configured number of bucket bits.int
getNumColumns()
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 Detail
-
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 Detail
-
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.
-
-