package connectionbroker
import "github.com/moby/swarmkit/v2/connectionbroker"
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 ¶
- type Broker
- func New(remotes remotes.Remotes) *Broker
- func (b *Broker) Remotes() remotes.Remotes
- func (b *Broker) Select(dialOpts ...grpc.DialOption) (*Conn, error)
- func (b *Broker) SelectRemote(dialOpts ...grpc.DialOption) (*Conn, error)
- func (b *Broker) SetLocalConn(localConn *grpc.ClientConn)
- type Conn
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 ¶
New creates a new connection broker.
func (*Broker) 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 ¶
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 ¶
Peer returns the peer for this Conn.
Source Files ¶
- Version
- v2.0.0-20250103191802-8c1959736554 (latest)
- Published
- Jan 3, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 1 week ago –
Tools for package owners.