pendingheap

package
v1.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pendingheap provides an implementation of a peer list that sends traffic to the peer with the fewest pending requests, but degenerates to round robin when all peers have equal pending requests, using a heap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Spec

Spec returns a configuration specification for the round-robin peer list implementation, making it possible to select the least recently chosen peer with transports that use outbound peer list configuration (like HTTP).

cfg := yarpcconfig.New()
cfg.MustRegisterPeerList(pendingheap.Spec())

This enables the round-robin peer list:

outbounds:
  otherservice:
    unary:
      http:
        url: https://host:port/rpc
        fewest-pending-requests:
          peers:
            - 127.0.0.1:8080
            - 127.0.0.1:8081

Types

type List

type List struct {
	*peerlist.List
}

List is a PeerList which rotates which peers are to be selected in a circle

func New

func New(transport peer.Transport, opts ...ListOption) *List

New creates a new pending heap.

type ListOption

type ListOption func(*listConfig)

ListOption customizes the behavior of a pending requests peer heap.

func Capacity

func Capacity(capacity int) ListOption

Capacity specifies the default capacity of the underlying data structures for this list.

Defaults to 10.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL