Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashBytes ¶
HashBytes processes the payload rapidly targeting the underlying architecture. Uses hardware-accelerated CRC32 instructions for routing resolutions.
func HashString ¶
HashString processes the payload rapidly targeting the underlying architecture. Uses hardware-accelerated CRC32 instructions for routing resolutions.
func HashUint64 ¶
HashUint64 retains xxhash purely to satisfy distribution qualities required by consistent hashing. Evaluates integer placements uniformly avoiding clustered collisions heavily.
Types ¶
type Adaptive ¶
type Adaptive struct {
// contains filtered or unexported fields
}
Adaptive load balancer wrapper. Leverages Backend's native atomic metrics (ResponseTime, InFlight) for lock-free, zero-allocation routing decisions using epsilon-greedy strategy.
func NewAdaptive ¶
NewAdaptive creates a lock-free adaptive load balancer. learningRate controls exploration probability (0-1). Clamped to 0.15 if invalid.
type Consistent ¶
type Consistent struct {
// contains filtered or unexported fields
}
func NewConsistent ¶
func NewConsistent(count int, replicas int) *Consistent
NewConsistent generates a distributed hashing ring mapping backends securely. Multiplies the total surface area by the specified replica count internally.
func (*Consistent) Get ¶
func (r *Consistent) Get(key uint64) int
Get locates the designated backend mapping for a specific cryptographic hash. Delegates to hardware-accelerated binary search logic for maximum speed.
type Selector ¶
type Selector struct {
Strategy Strategy
// contains filtered or unexported fields
}
func NewSelector ¶
type Sticky ¶
type Sticky struct {
// contains filtered or unexported fields
}
Sticky adds session persistence using jack.Reaper for efficient TTL management
func NewSticky ¶
NewSticky wraps a balancer with session affinity. Uses jack.Reaper for O(log N) expiration and mappo.LRU for bounded caching.
func (*Sticky) Stop ¶
func (s *Sticky) Stop()
Stop gracefully shuts down the reaper and child balancer.
type Strategy ¶
type Strategy uint8
func ParseStrategy ¶
ParseStrategy translates string definitions into load balancing enumerators securely. Assigns the standard RoundRobin approach if matching configurations fail.
type WeightWheel ¶
type WeightWheel struct {
// contains filtered or unexported fields
}
func NewWheel ¶
func NewWheel(weights []int) *WeightWheel
NewWheel constructs a distributed scale mapped directly to backend capacities. Normalizes empty variables guarding against zero-sum divisions implicitly.
func (*WeightWheel) Next ¶
func (w *WeightWheel) Next(counter uint64) int
Next generates an isolated offset translating counters into array indices. Redirects processing immediately if wheel configurations stand empty.
func (*WeightWheel) RandomIndex ¶
func (w *WeightWheel) RandomIndex(r *rand.Rand) int
RandomIndex processes asynchronous numeric ranges avoiding predictable cycles. Empowers random routing selectors efficiently mapping capacities uniformly.