connection

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package connection manages persistent gRPC connections to nstance-server zone shards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages persistent gRPC connections to all zone shards

func NewManager

func NewManager(tlsConfig *tls.Config, logger logr.Logger) *Manager

NewManager creates a new connection manager

func (*Manager) Close

func (m *Manager) Close() error

Close closes all connections

func (*Manager) Connect

func (m *Manager) Connect(ctx context.Context, endpoints map[string]string) error

Connect establishes connections to all shard endpoints

func (*Manager) GetAllConnections

func (m *Manager) GetAllConnections() map[string]*grpc.ClientConn

GetAllConnections returns all shard connections.

func (*Manager) GetConnection

func (m *Manager) GetConnection(ctx context.Context) (*grpc.ClientConn, string, error)

GetConnection returns a gRPC connection to any available shard.

type Provider

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

Provider provides access to shard connections. It can be created before connections are established and populated later, allowing controllers to be set up before the manager starts while still receiving connections after registration completes.

func NewProvider

func NewProvider() *Provider

NewProvider creates a new connection provider

func (*Provider) Get

func (p *Provider) Get() map[string]*grpc.ClientConn

Get returns all shard connections, or nil if not yet ready

func (*Provider) Set

func (p *Provider) Set(conns map[string]*grpc.ClientConn)

Set sets the shard connections. This should be called after registration completes and connections are established.

Jump to

Keyboard shortcuts

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