Documentation ¶
Index ¶
- func BuildPeerInformer(stopper chan struct{}, peerRing *ShardHelper, ringConfig consistent.Config, ...) cache.SharedIndexInformer
- func Jitter(t time.Duration, maxJitterPercent int) (time.Duration, error)
- func JitterRequeue(defaultDuration time.Duration, maxJitterPercent int, log logr.Logger) reconcile.Result
- func SliceContains(s []string, value string) bool
- type ShardHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPeerInformer ¶ added in v0.5.0
func BuildPeerInformer(stopper chan struct{}, peerRing *ShardHelper, ringConfig consistent.Config, log logr.Logger) cache.SharedIndexInformer
func Jitter ¶ added in v0.4.1
Jitter accepts a Duration and maximum percentage to jitter (as an int), and returns a random Duration in the range t +/- maxJitterPercent.
func JitterRequeue ¶ added in v0.4.1
func JitterRequeue(defaultDuration time.Duration, maxJitterPercent int, log logr.Logger) reconcile.Result
JitterRequeue accepts a default requeue time, a maximum percentage to jitter, and a logger, and returns a Result containing a requeue time which has been randomized with jitter.
func SliceContains ¶
Types ¶
type ShardHelper ¶ added in v0.5.0
type ShardHelper struct { PodIP string ServiceName string ServiceNamespace string // contains filtered or unexported fields }
func BuildPeerHashRing ¶ added in v0.5.0
func BuildPeerHashRing(consistentCfg consistent.Config, podIP string, serviceName string, serviceNamespace string) *ShardHelper
func (*ShardHelper) GetShardOwner ¶ added in v0.5.0
func (r *ShardHelper) GetShardOwner(input string) string
Returns the name (IP) of the shard which should own a provided object name.
func (*ShardHelper) MemberCount ¶ added in v0.5.0
func (r *ShardHelper) MemberCount() int
Returns the number of members/peers currently in the hash ring.
func (*ShardHelper) SetMembers ¶ added in v0.5.0
func (r *ShardHelper) SetMembers(newMembers map[string]struct{})
SetMembers accepts a map where the keys are member IPs and uses those IPs as the members for sharding.
func (*ShardHelper) SetMembersFromLists ¶ added in v0.5.0
func (r *ShardHelper) SetMembersFromLists(lists ...[]string)
SetMembersFromLists is a wrapper around SetMember which accepts slices instead of a map.
func (*ShardHelper) ShouldOwn ¶ added in v0.5.0
func (r *ShardHelper) ShouldOwn(input string) bool
Returns whether the current shard should own the object with the provided name.