kubernetes

package
v0.0.50-alpha.108 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPCName = "grpc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnManager

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

func NewConnManager

func NewConnManager(namespace string, watchNames []string, options ...grpc.DialOption) (*ConnManager, error)

NewConnManager creates a new connection manager that uses Kubernetes services for service discovery.

func (*ConnManager) AddOption

func (k *ConnManager) AddOption(opts ...grpc.DialOption)

AddOption appends gRPC dial options to the existing options.

func (*ConnManager) Close

func (k *ConnManager) Close()

Close closes all gRPC connections managed by ConnManager.

func (*ConnManager) DelData

func (k *ConnManager) DelData(ctx context.Context, key string) error

func (*ConnManager) GetConn

func (k *ConnManager) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (grpc.ClientConnInterface, error)

GetConn returns a single gRPC client connection for a given Kubernetes service name.

func (*ConnManager) GetConns

func (k *ConnManager) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]grpc.ClientConnInterface, error)

GetConns returns gRPC client connections for a given Kubernetes service name.

func (*ConnManager) GetKey

func (k *ConnManager) GetKey(ctx context.Context, key string) ([]byte, error)

func (*ConnManager) GetKeyWithPrefix

func (k *ConnManager) GetKeyWithPrefix(ctx context.Context, key string) ([][]byte, error)

func (*ConnManager) GetSelfConnTarget

func (k *ConnManager) GetSelfConnTarget() string

GetSelfConnTarget returns the connection target for the current service.

func (*ConnManager) GetUserIdHashGatewayHost

func (k *ConnManager) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error)

func (*ConnManager) IsSelfNode

func (k *ConnManager) IsSelfNode(cc grpc.ClientConnInterface) bool

func (*ConnManager) Register

func (k *ConnManager) Register(ctx context.Context, serviceName, host string, port int, opts ...grpc.DialOption) error

func (*ConnManager) SetKey

func (k *ConnManager) SetKey(ctx context.Context, key string, data []byte) error

func (*ConnManager) SetWithLease

func (k *ConnManager) SetWithLease(ctx context.Context, key string, val []byte, ttl int64) error

func (*ConnManager) UnRegister

func (k *ConnManager) UnRegister() error

func (*ConnManager) WatchKey

func (k *ConnManager) WatchKey(ctx context.Context, key string, fn discovery.WatchKeyHandler) error

Jump to

Keyboard shortcuts

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