remotecli

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package remotecli for remote client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// RPCInfo as param just avoid to get it from ctx
	Send(ctx context.Context, ri rpcinfo.RPCInfo, req remote.Message) (err error)
	Recv(ctx context.Context, ri rpcinfo.RPCInfo, resp remote.Message) (err error)
	Recycle()
}

Client implementation may be different between mux and non-mux clients.

func NewClient

func NewClient(ctx context.Context, ri rpcinfo.RPCInfo, handler remote.TransHandler, opt *remote.ClientOption) (Client, error)

NewClient creates a new Client using the given params.

type ConnReleaser added in v0.10.0

type ConnReleaser interface {
	ReleaseConn(err error, ri rpcinfo.RPCInfo)
}

ConnReleaser helps to release the raw connection.

type ConnWrapper

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

ConnWrapper wraps a connection.

func NewConnWrapper

func NewConnWrapper(connPool remote.ConnPool) *ConnWrapper

NewConnWrapper returns a new ConnWrapper using the given connPool and logger.

func (*ConnWrapper) GetConn

func (cm *ConnWrapper) GetConn(ctx context.Context, d remote.Dialer, ri rpcinfo.RPCInfo) (net.Conn, error)

GetConn returns a connection using the given Dialer and RPCInfo.

func (*ConnWrapper) ReleaseConn

func (cm *ConnWrapper) ReleaseConn(err error, ri rpcinfo.RPCInfo)

ReleaseConn should notice that ri may nil when oneway TODO duplicate release may cause problem?

type StreamConnManager added in v0.10.0

type StreamConnManager struct {
	ConnReleaser
}

StreamConnManager manages the underlying connection of the stream

func NewStream

NewStream create a client side stream

func NewStreamConnManager added in v0.10.0

func NewStreamConnManager(cr ConnReleaser) *StreamConnManager

NewStreamConnManager returns a new StreamConnManager

func (*StreamConnManager) ReleaseConn added in v0.10.0

func (scm *StreamConnManager) ReleaseConn(err error, ri rpcinfo.RPCInfo)

ReleaseConn releases the raw connection of the stream

Jump to

Keyboard shortcuts

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