tracker

package
v0.0.0-...-d34d691 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownstreamConns

type DownstreamConns struct {
	// contains filtered or unexported fields
}

DownstreamConns tracks connections per downstream based on a unique string identifier. DownstreamConns safe for concurrent use.

func NewDownstreamConns

func NewDownstreamConns() *DownstreamConns

NewDownstreamConns initializes and returns a DownstreamConns with

func (*DownstreamConns) ConnectionEnded

func (t *DownstreamConns) ConnectionEnded(downstreamID string)

ConnectionEnded decrements the count of connections for a given downstreamID.

func (*DownstreamConns) TryRecordConnection

func (t *DownstreamConns) TryRecordConnection(downstreamID string, max uint32) bool

TryRecordConnection checks if a downstreamID's connections are below the provided max and if so records an additional connection for the downstream. If the downstream has no history, a new count will be started. The return indicates if the new connection should be allowed.

type UpstreamConns

type UpstreamConns struct {
	// contains filtered or unexported fields
}

UpstreamConns tracks connections for an upstreamGroup on a per upstream basis. Upstreams can be marked as unhealthy to prevent them from being chosen for new connections. UpstreamConns handles load balancing through BeginConnection()

func NewUpstreamConns

func NewUpstreamConns(upstreamIDs []uuid.UUID) *UpstreamConns

NewUpstreamConns creates a new UpstreamConns with upstreams based on provided upstreamIDs. upstreams must be marked as healthy before they will be added to the internal priorityQueue and available for BeginConnection()

func (*UpstreamConns) ConnectionEnded

func (t *UpstreamConns) ConnectionEnded(id uuid.UUID)

ConnectionEnded takes the UUID of the upstream which has just had a connection terminate and records the ended connection.

func (*UpstreamConns) NextAvailableUpstream

func (t *UpstreamConns) NextAvailableUpstream() (uuid.UUID, error)

NextAvailableUpstream returns the UUID of the upstream with the least connections and records the additional connection. An error is returned if there are no available upstreams

func (*UpstreamConns) UpstreamAvailable

func (t *UpstreamConns) UpstreamAvailable(id uuid.UUID)

UpstreamAvailable is used to restore an upstream to the available upstreams

func (*UpstreamConns) UpstreamUnavailable

func (t *UpstreamConns) UpstreamUnavailable(id uuid.UUID)

UpstreamUnavailable is used to remove an upstream from the available upstreams

Jump to

Keyboard shortcuts

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