Documentation
¶
Overview ¶
Package chtest provides some helper hash-functions for use with the parent consistenthash package (and galaxycache) to provide particular owners for specific keys.
This package cannot be imported outside of tests. If testing.Testing returns false, it will panic in init() unless compiled with the `testing_binary_chtest_can_panic_at_any_time` build tag (intended to be used for tests that require running a separate binary (e.g. integration/interop tests)).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FallthroughKey ¶
FallthroughKey constructs a key that is owned by original owner, and if origOwner is removed from the hash-ring, falls through to fallthroughOwner. ... as long as both owners were included in the call to NewMapArgs
func SingleOwnerKey ¶
SingleOwnerKey returns a key that is guaranteed to map to that owner (as long as that owner was included in the call to NewMapArgs
Types ¶
type Args ¶
type Args struct {
Owners []string
// Map from a key to a set of replicas to the set of owners to map this key into for its sequential replicas (GetReplicated)
// if the value is nil, then one hash for each owner is picked sequentially
RegisterKeys map[string][]string
}
Args is an argument struct to NewMapArgs
type MapArgs ¶
MapArgs provides the values that should be passed through to consistenthash.NewMap (possibly indirectly)
func NewMapArgs ¶
NewMapArgs creates a consistenthash.Map that uses a constructed "hash function" that is engineered to pick the correct, the integer it computes required value of segsPerKey to make every ordering of the entries in owners appear in the hashring.
func (*MapArgs) NewMap ¶
func (m *MapArgs) NewMap() *consistenthash.Map
NewMap creates a new consistenthash.Map with the args from the receiver. It does _not_ populate the hashring.