grpc_pool

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConnMap map[string]Pool
	NodeMap map[string]*fs.ServerNode
)
View Source
var ClosedErr = errors.New("grpc pool has closed")

Functions

func LoadLeastNode

func LoadLeastNode(ctx context.Context, m map[string]*fs.ServerNode) (err error)

Types

type Builder

type Builder func() (*grpc.ClientConn, error)

type ClientConn

type ClientConn interface {
	grpc.ClientConnInterface
	// contains filtered or unexported methods
}

type Conn

type Conn interface {
	Conn() ClientConn
	// contains filtered or unexported methods
}

type Option

type Option func(*option)

Option optional configs

type Pool

type Pool interface {
	Get() (Conn, error)
	Restore(Conn)
	Close()
}

func GetLeastNodePool

func GetLeastNodePool() Pool

func GetNodeConn

func GetNodeConn() (Pool, error)

func NewPool

func NewPool(builder Builder, options ...Option) (Pool, error)

Jump to

Keyboard shortcuts

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