Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FixedHashBucket ¶ added in v0.0.5
type FixedHashBucket struct {
// contains filtered or unexported fields
}
FixedHashBucket represents a mechanism for determining whether supplied keys belong to the current bucket index. It uses a consistent hashing ring to distribute keys across buckets based on their hash values.
func NewFixedHashBucket ¶ added in v0.0.5
func NewFixedHashBucket(size uint) *FixedHashBucket
NewFixedHashBucket creates and initializes a new FixedHashBucket with the specified size.
func (*FixedHashBucket) Advance ¶ added in v0.0.5
func (h *FixedHashBucket) Advance()
Advance increments the bucket index to point to the next bucket in the hash ring.
func (*FixedHashBucket) InBucket ¶ added in v0.0.5
func (h *FixedHashBucket) InBucket(key string) bool
InBucket determines if the given key belongs to the current bucket index.
type HashBucket ¶
type HashBucket interface {
// InBucket checks if the provided key belongs to the current bucket.
InBucket(key string) bool
}
HashBucket is an interface that defines a method to check if a given key belongs to the current bucket.
type ServiceEndpointHashBucket ¶ added in v0.0.5
type ServiceEndpointHashBucket struct {
// contains filtered or unexported fields
}
ServiceEndpointHashBucket represents a mechanism which determines whether the current application instance should process a particular key. The bucket size is determined by the number of active endpoints in the supplied Kubernetes service.
func NewServiceEndpointHashBucket ¶
func NewServiceEndpointHashBucket( l *slog.Logger, kubeClient kubernetes.Interface, appName, appNamespace, thisPod string, ) *ServiceEndpointHashBucket
NewServiceEndpointHashBucket initializes and returns a new instance of ServiceEndpointHashBucket.
func (*ServiceEndpointHashBucket) InBucket ¶ added in v0.0.5
func (sb *ServiceEndpointHashBucket) InBucket(key string) bool
InBucket checks if the given key is assigned to the current application instance based on the consistent hash ring.
func (*ServiceEndpointHashBucket) Shutdown ¶ added in v0.0.5
func (sb *ServiceEndpointHashBucket) Shutdown()
Shutdown cleans up the resources used by the ServiceEndpointHashBucket.