package conn

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/conn"

Index

Constants

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

Functions

func IsBadConn

func IsBadConn(err error, goodConnCodes ...grpcCodes.Code) bool

func UseWrapping

func UseWrapping(ctx context.Context) bool

func WithAppendOptions

func WithAppendOptions(cc grpc.ClientConnInterface, appendOpts ...grpc.CallOption) grpc.ClientConnInterface

func WithBeforeFunc

func WithBeforeFunc(
	cc grpc.ClientConnInterface,
	before func(),
) grpc.ClientConnInterface

func WithContextModifier

func WithContextModifier(
	cc grpc.ClientConnInterface,
	modifyCtx func(ctx context.Context) context.Context,
) grpc.ClientConnInterface

func WithoutWrapping

func WithoutWrapping(ctx context.Context) context.Context

Types

type Config

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

type Conn

type Conn interface {
	grpc.ClientConnInterface

	Endpoint() endpoint.Endpoint

	LastUsage() time.Time

	Ping(ctx context.Context) error
	IsState(states ...State) bool
	GetState() State
	SetState(ctx context.Context, state State) State
	Unban(ctx context.Context) State
}

type Pool

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

func NewPool

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

func (*Pool) Allow

func (p *Pool) Allow(ctx context.Context, cc Conn)

func (*Pool) Ban

func (p *Pool) Ban(ctx context.Context, cc Conn, cause error)

func (*Pool) DialTimeout

func (p *Pool) DialTimeout() time.Duration

func (*Pool) Get

func (p *Pool) Get(endpoint endpoint.Endpoint) Conn

func (*Pool) GrpcDialOptions

func (p *Pool) GrpcDialOptions() []grpc.DialOption

func (*Pool) Release

func (p *Pool) Release(ctx context.Context) (finalErr error)

func (*Pool) Take

func (p *Pool) Take(context.Context) error

func (*Pool) Trace

func (p *Pool) Trace() *trace.Driver

type State

type State int8

func (State) Code

func (s State) Code() int

func (State) IsValid

func (s State) IsValid() bool

func (State) String

func (s State) String() string

Source Files

config.go conn.go context.go errors.go grpc_client_stream.go middleware.go pool.go state.go

Version
v3.98.0
Published
Jan 20, 2025
Platform
js/wasm
Imports
23 packages
Last checked
3 minutes ago

Tools for package owners.