Clean up useless functions, only keep the basic function Deal
and the function DealIntoHand which will be used by Priority
and Fairness.
Improve some comments for constants and functions.
Introduce Dealer to combine parameters and methods into a whole.
Use fixed-size slice to improve performance.
Use math.Ceil and math.Log2 to calculate required entropy bits.
Make the given hand adaptive to handSize in DealIntoHand.
Signed-off-by: Bruce Ma <brucema19901024@gmail.com>
Kubernetes-commit: 7a3ca070cdd9804a22bf5db8a99576b09fc52484
Changes following up on shuffle sharding util package.
Made the validation checking function return a slice of error messages
rather than just a bit.
Replaced all the `int32` with `int` because this is intended for more
than just the priority-and-faireness feature and so should not be a
slave to its configuration datatypes.
Introduced ShuffleAndDealIntoHand, to make memory allocation the
caller's problem/privilege.
Made the hand uniformity tester avoid reflection, evaluate the
histogram against the expected range of counts, and run multiple test
cases, including one in which the number of hash values is a power of
two with four extra bits (as the validation check requires) and one in
which the deck size is not a power of two.
Kubernetes-commit: da0b647155912c6b1e6b971aa5685768915d810d
Implement several shuffle sharding functions including ShuffleAndDeal,
ShuffleAndDealToSlice.
Add benchmarks and tests for shuffle sharding to test performance,
correctness and distribution uniformity.
Signed-off-by: Bruce Ma <brucema19901024@gmail.com>
Kubernetes-commit: e97eaef4f65ec2cbfebf4fd9e726c9e2a6bf5499