rs

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCannotResponse = fmt.Errorf("cann't send reponse to client")
View Source
var (
	ErrorNotImplement = errors.New("not implement")
)

Functions

This section is empty.

Types

type ClientRpcContext

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

ClientRpcContext 客户端侧的 RPC 上下文处理

func (*ClientRpcContext) Close

func (rpc *ClientRpcContext) Close() error

func (*ClientRpcContext) Receive

func (rpc *ClientRpcContext) Receive() (<-chan *api.ServerResponse, <-chan error)

func (*ClientRpcContext) Send

func (rpc *ClientRpcContext) Send(resp *api.ServerRequest)

type ConnManager

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

func (*ConnManager) AddConnectEventListener

func (cm *ConnManager) AddConnectEventListener(listener api.ConnectEventListener)

AddConnectEventListener

func (*ConnManager) PutConn

func (cm *ConnManager) PutConn(conn *transport.TCPConn)

PutConn 添加一个 transport.TCPConn

func (*ConnManager) RemoveConn

func (cm *ConnManager) RemoveConn(conn *transport.TCPConn)

RemoveConn 移除某一个 transport.TCPConn

func (*ConnManager) RemoveConnectEventListener

func (cm *ConnManager) RemoveConnectEventListener(listener api.ConnectEventListener)

RemoveConnectEventListener

type RSocketClient

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

func NewClient

func NewClient(opt api.ClientOption) (*RSocketClient, error)

TODO 后续改造成为 Option 的模式

func (*RSocketClient) AddChain

func (c *RSocketClient) AddChain(filter func(req *api.ServerRequest))

func (*RSocketClient) CheckConnection

func (c *RSocketClient) CheckConnection(endpoint api.Endpoint) (bool, error)

func (*RSocketClient) Close

func (c *RSocketClient) Close() error

func (*RSocketClient) RegisterConnectEventWatcher

func (c *RSocketClient) RegisterConnectEventWatcher(watcher func(eventType api.ConnectEventType, conn net.Conn))

func (*RSocketClient) Request

func (c *RSocketClient) Request(ctx context.Context, endpoint api.Endpoint, req *api.ServerRequest) (*api.ServerResponse, error)

func (*RSocketClient) RequestChannel

func (c *RSocketClient) RequestChannel(ctx context.Context, endpoint api.Endpoint) (api.RpcClientContext, error)

type RSocketDispatcher

type RSocketDispatcher struct {
	api.Dispatcher
	// contains filtered or unexported fields
}

type RSocketServer

type RSocketServer struct {
	IsReady chan int8

	ConnMgr *ConnManager
	ErrChan chan error
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, opt api.ServerOption) *RSocketServer

newRSocketServer 创建一个 RSocketServer

func (*RSocketServer) AddConnectEventListener

func (rs *RSocketServer) AddConnectEventListener(listener api.ConnectEventListener)

AddConnectEventListener

func (*RSocketServer) RegisterChannelHandler

func (rs *RSocketServer) RegisterChannelHandler(funName string, handler api.ChannelHandler)

RegisterChannelHandler

func (*RSocketServer) RegisterSimpleHandler

func (rs *RSocketServer) RegisterSimpleHandler(funName string, handler api.SimpleHandler)

RegisterSimpleHandler

func (*RSocketServer) RemoveConnectEventListener

func (rs *RSocketServer) RemoveConnectEventListener(listener api.ConnectEventListener)

RemoveConnectEventListener

type ServerRpcContext

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

func (*ServerRpcContext) Close

func (rpc *ServerRpcContext) Close() error

func (*ServerRpcContext) Complete

func (rpc *ServerRpcContext) Complete()

func (*ServerRpcContext) GetReq

func (rpc *ServerRpcContext) GetReq() *api.ServerRequest

func (*ServerRpcContext) Send

func (rpc *ServerRpcContext) Send(resp *api.ServerResponse) error

Jump to

Keyboard shortcuts

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