conn

package
v3.11.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = State(iota)
	Created
	Online
	Banned
	Offline
	Destroyed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	DialTimeout() time.Duration
	Trace() trace.Driver
	ConnectionTTL() time.Duration
	GrpcDialOptions() []grpc.DialOption
}

type Conn

type Conn interface {
	grpc.ClientConnInterface

	Endpoint() endpoint.Endpoint

	IsState(states ...State) bool
	GetState() State
	SetState(context.Context, State) State
	Close(ctx context.Context) error
	Park(ctx context.Context) error
	TTL() <-chan time.Time
}

func New

func New(endpoint endpoint.Endpoint, config Config) Conn

type Pessimizer added in v3.10.0

type Pessimizer interface {
	Pessimize(ctx context.Context, e endpoint.Endpoint) error
}

type Pool added in v3.7.0

type Pool interface {
	closer.Closer
	Pessimizer
	PoolGetter
}

func NewPool added in v3.7.0

func NewPool(ctx context.Context, config Config) Pool

type PoolConfig added in v3.7.0

type PoolConfig interface {
	ConnectionTTL() time.Duration
	GrpcDialOptions() []grpc.DialOption
}

type PoolGetter added in v3.10.0

type PoolGetter interface {
	GetConn(endpoint endpoint.Endpoint) Conn
}

type PoolGetterCloser added in v3.10.0

type PoolGetterCloser interface {
	PoolGetter
	closer.Closer
}

type State added in v3.7.0

type State int8

func (State) Code added in v3.7.0

func (s State) Code() int

func (State) IsValid added in v3.7.0

func (s State) IsValid() bool

func (State) String added in v3.7.0

func (s State) String() string

Jump to

Keyboard shortcuts

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