conn

package
v3.16.8-rc0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 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

func WithoutWrapping added in v3.11.8

func WithoutWrapping(ctx context.Context) context.Context

Types

type Config

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

type Conn

type Conn interface {
	grpc.ClientConnInterface

	Endpoint() endpoint.Endpoint

	LastUsage() time.Time

	IsState(states ...State) bool
	GetState() State
	SetState(State) State

	Release(ctx context.Context) error
}

func New

func New(e endpoint.Endpoint, config Config, opts ...option) Conn

type Getter added in v3.14.4

type Getter interface {
	Get(endpoint endpoint.Endpoint) Conn
}

type Pessimizer added in v3.10.0

type Pessimizer interface {
	Pessimize(ctx context.Context, cc Conn, cause error)
}

type Pool added in v3.7.0

type Pool interface {
	Getter
	Taker
	Releaser
	Pessimizer
}

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 Releaser added in v3.13.0

type Releaser interface {
	Release(ctx context.Context) error
}

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

type Taker added in v3.13.0

type Taker interface {
	Take(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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