grpc: Index | Files

package wrr

import ""


Package Files

edf.go random.go wrr.go

type WRR Uses

type WRR interface {
    // Add adds an item with weight to the WRR set.
    Add(item interface{}, weight int64)
    // Next returns the next picked item.
    // Next needs to be thread safe.
    Next() interface{}

WRR defines an interface that implements weighted round robin.

func NewEDF Uses

func NewEDF() WRR

NewEDF creates Earliest Deadline First (EDF) ( implementation for weighted round robin. Each pick from the schedule has the earliest deadline entry selected. Entries have deadlines set at current time + 1 / weight, providing weighted round robin behavior with O(log n) pick time.

func NewRandom Uses

func NewRandom() WRR

NewRandom creates a new WRR with random.

Package wrr imports 3 packages (graph) and is imported by 1 packages. Updated 2019-08-16. Refresh now. Tools for package owners.