netpollmux

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnClosed = errors.New("conn closed")

ErrConnClosed .

Functions

func NewCliTransHandlerFactory

func NewCliTransHandlerFactory() remote.ClientTransHandlerFactory

NewCliTransHandlerFactory creates a new netpollmux client transport handler factory.

func NewSvrTransHandlerFactory

func NewSvrTransHandlerFactory() remote.ServerTransHandlerFactory

NewSvrTransHandlerFactory creates a default netpollmux remote.ServerTransHandlerFactory.

Types

type ControlFrame added in v0.3.0

type ControlFrame struct{}

func NewControlFrame added in v0.3.0

func NewControlFrame() *ControlFrame

func (*ControlFrame) Read added in v0.3.0

func (p *ControlFrame) Read(iprot thrift.TProtocol) (err error)

func (*ControlFrame) String added in v0.3.0

func (p *ControlFrame) String() string

func (*ControlFrame) Write added in v0.3.0

func (p *ControlFrame) Write(oprot thrift.TProtocol) (err error)

type EventHandler

type EventHandler interface {
	Recv(bufReader remote.ByteBuffer, err error) error
}

EventHandler is used to handle events

type MuxPool

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

MuxPool manages a pool of long connections.

func NewMuxConnPool

func NewMuxConnPool(size int) *MuxPool

NewMuxConnPool size must be adjust to 2^N

func (*MuxPool) Clean

func (mp *MuxPool) Clean(network, address string)

Clean implements the LongConnPool interface.

func (*MuxPool) Close

func (mp *MuxPool) Close() error

Close is to release resource of ConnPool, it is executed when client is closed.

func (*MuxPool) Discard

func (mp *MuxPool) Discard(conn net.Conn) error

Discard implements the ConnPool interface.

func (*MuxPool) Get

func (mp *MuxPool) Get(ctx context.Context, network, address string, opt remote.ConnOption) (net.Conn, error)

Get pick or generate a net.Conn and return

func (*MuxPool) Put

func (mp *MuxPool) Put(conn net.Conn) error

Put implements the ConnPool interface.

Jump to

Keyboard shortcuts

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