Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionTracker ¶
ConnectionTracker keep connections and maintain their status
func New ¶
func New(dial DialFunc, opts ...TrackerOption) *ConnectionTracker
New initialization ConnectionTracker
func (*ConnectionTracker) Alives ¶
func (ct *ConnectionTracker) Alives() []string
Alives current live connections
func (*ConnectionTracker) Dial ¶
func (ct *ConnectionTracker) Dial(addr string) (*grpc.ClientConn, error)
Dial force to create new connection, this operation will close old connection!
func (*ConnectionTracker) GetConn ¶
func (ct *ConnectionTracker) GetConn(addr string) (*grpc.ClientConn, error)
GetConn create or get an existing connection
type ReadyCheckFunc ¶
type ReadyCheckFunc func(ctx context.Context, conn *grpc.ClientConn) connectivity.State
ReadyCheckFunc check conn is ready function
type TrackerOption ¶
type TrackerOption func(*ConnectionTracker)
TrackerOption initialization options
func CustomReadyCheck ¶
func CustomReadyCheck(f ReadyCheckFunc) TrackerOption
CustomReadyCheck custom ready check function
func SetCheckReadyTimeout ¶
func SetCheckReadyTimeout(timeout time.Duration) TrackerOption
SetCheckReadyTimeout custom checkReadyTimeout
func SetHeartbeatInterval ¶
func SetHeartbeatInterval(interval time.Duration) TrackerOption
SetHeartbeatInterval custom heartbeatInterval
Click to show internal directories.
Click to hide internal directories.