multiplex

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 17 Imported by: 0

Documentation

Overview

Package multiplex implements a connection pool that supports connection multiplexing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnClosed indicates connection is closed.
	ErrConnClosed = errors.New("connection is closed")
	// ErrDuplicateID indicates request ID already exist.
	ErrDuplicateID = errors.New("request ID already exist")
	// ErrInvalid indicates the operation is invalid.
	ErrInvalid = errors.New("it's invalid")
)

Functions

func NewPool

func NewPool(dialFunc connpool.DialFunc, opt ...OptPool) multiplexed.Pool

NewPool creates a new multiplex pool, which uses dialFunc to dial new connections.

Types

type OptPool

type OptPool func(*PoolOption)

OptPool is function to modify PoolOption.

func WithDialTimeout

func WithDialTimeout(timeout time.Duration) OptPool

WithDialTimeout returns an OptPool which sets dial timeout.

func WithEnableMetrics

func WithEnableMetrics() OptPool

WithEnableMetrics returns an OptPool which enable metrics.

func WithMaxConcurrentVirConnsPerConn

func WithMaxConcurrentVirConnsPerConn(max int) OptPool

WithMaxConcurrentVirConnsPerConn returns an OptPool which sets the number of concurrent virtual connections per connection.

type PoolOption

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

PoolOption represents some settings for the multiplex pool.

Jump to

Keyboard shortcuts

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