connectionbroker

package
v1.12.1-0...-676f45f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package connectionbroker is a layer on top of remotes that returns a gRPC connection to a manager. The connection may be a local connection using a local socket such as a UNIX socket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker is a simple connection broker. It can either return a fresh connection to a remote manager selected with weighted randomization, or a local gRPC connection to the local manager.

func New

func New(remotes remotes.Remotes) *Broker

New creates a new connection broker.

func (*Broker) Remotes

func (b *Broker) Remotes() remotes.Remotes

Remotes returns the remotes interface used by the broker, so the caller can make observations or see weights directly.

func (*Broker) Select

func (b *Broker) Select(dialOpts ...grpc.DialOption) (*Conn, error)

Select a manager from the set of available managers, and return a connection.

func (*Broker) SelectRemote

func (b *Broker) SelectRemote(dialOpts ...grpc.DialOption) (*Conn, error)

SelectRemote chooses a manager from the remotes, and returns a TCP connection.

func (*Broker) SetLocalConn

func (b *Broker) SetLocalConn(localConn *grpc.ClientConn)

SetLocalConn changes the local gRPC connection used by the connection broker.

type Conn

type Conn struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

Conn is a wrapper around a gRPC client connection.

func (*Conn) Close

func (c *Conn) Close(success bool) error

Close closes the client connection if it is a remote connection. It also records a positive experience with the remote peer if success is true, otherwise it records a negative experience. If a local connection is in use, Close is a noop.

func (*Conn) Peer

func (c *Conn) Peer() api.Peer

Peer returns the peer for this Conn.

Jump to

Keyboard shortcuts

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