remoting

package
v0.0.0-...-ba2213e Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FRAME_MAX_LENGTH = 8388608
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRemotingAchieve

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

func (*BaseRemotingAchieve) RegisterDefaultProcessor

func (ra *BaseRemotingAchieve) RegisterDefaultProcessor(processor RequestProcessor)

RegisterDefaultProcessor register default porcessor

func (*BaseRemotingAchieve) RegisterProcessor

func (ra *BaseRemotingAchieve) RegisterProcessor(requestCode int32, processor RequestProcessor)

RegisterProcessor register porcessor

func (*BaseRemotingAchieve) RegisterRPCHook

func (ra *BaseRemotingAchieve) RegisterRPCHook(rpcHook RPCHook)

RegisterRPCHook 注册rpc hook

type DefalutRemotingClient

type DefalutRemotingClient struct {
	BaseRemotingAchieve
	// contains filtered or unexported fields
}

DefalutRemotingClient default remoting client

func NewDefalutRemotingClient

func NewDefalutRemotingClient() *DefalutRemotingClient

NewDefalutRemotingClient return new default remoting client

func (*DefalutRemotingClient) GetNameServerAddressList

func (rc *DefalutRemotingClient) GetNameServerAddressList() []string

GetNameServerAddressList return nameserver addr list

func (*DefalutRemotingClient) InvokeAsync

func (rc *DefalutRemotingClient) InvokeAsync(addr string, request *protocol.RemotingCommand, timeoutMillis int64, invokeCallback InvokeCallback) error

InvokeAsync 异步调用

func (*DefalutRemotingClient) InvokeOneway

func (rc *DefalutRemotingClient) InvokeOneway(addr string, request *protocol.RemotingCommand, timeoutMillis int64) error

InvokeSync 单向发送消息

func (*DefalutRemotingClient) InvokeSync

func (rc *DefalutRemotingClient) InvokeSync(addr string, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)

InvokeSync 同步调用并返回响应, addr为空字符串,则在namesrvAddrList中选择地址

func (*DefalutRemotingClient) RegisterContextListener

func (rc *DefalutRemotingClient) RegisterContextListener(contextListener netm.ContextListener)

RegisterContextListener 注册context listener

func (*DefalutRemotingClient) Shutdown

func (rc *DefalutRemotingClient) Shutdown()

Shutdown shutdown client

func (*DefalutRemotingClient) Start

func (rc *DefalutRemotingClient) Start()

Start start client

func (*DefalutRemotingClient) UpdateNameServerAddressList

func (rc *DefalutRemotingClient) UpdateNameServerAddressList(addrs []string)

UpdateNameServerAddressList update nameserver addrs list

type DefalutRemotingServer

type DefalutRemotingServer struct {
	BaseRemotingAchieve
	// contains filtered or unexported fields
}

DefalutRemotingServer default remoting server

func NewDefalutRemotingServer

func NewDefalutRemotingServer(host string, port int) *DefalutRemotingServer

NewDefalutRemotingServer return new default remoting server

func (*DefalutRemotingServer) GetListenPort

func (rs *DefalutRemotingServer) GetListenPort() string

GetListenPort 获得监听端口字符串 Author rongzhihong Since 2017/9/5

func (*DefalutRemotingServer) InvokeAsync

func (rs *DefalutRemotingServer) InvokeAsync(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64, invokeCallback InvokeCallback) error

InvokeAsync 异步调用

func (*DefalutRemotingServer) InvokeOneway

func (rs *DefalutRemotingServer) InvokeOneway(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64) error

InvokeSync 单向发送消息

func (*DefalutRemotingServer) InvokeSync

func (rs *DefalutRemotingServer) InvokeSync(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)

InvokeSync 同步调用并返回响应, addr为空字符串

func (*DefalutRemotingServer) Port

func (rs *DefalutRemotingServer) Port() int32

Port 获得监听端口 Author rongzhihong Since 2017/9/5

func (*DefalutRemotingServer) RegisterContextListener

func (rs *DefalutRemotingServer) RegisterContextListener(contextListener netm.ContextListener)

RegisterContextListener 注册context listener

func (*DefalutRemotingServer) Shutdown

func (rs *DefalutRemotingServer) Shutdown()

Shutdown shutdown server

func (*DefalutRemotingServer) Start

func (rs *DefalutRemotingServer) Start()

Start start server

type InvokeCallback

type InvokeCallback func(responseFuture *ResponseFuture)

InvokeCallback async invoke callback

type LengthFieldFragmentationAssemblage

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

func NewLengthFieldFragmentationAssemblage

func NewLengthFieldFragmentationAssemblage(maxFrameLength, lengthFieldOffset, lengthFieldLength, initialBytesToStrip int) *LengthFieldFragmentationAssemblage

func (*LengthFieldFragmentationAssemblage) Pack

func (lfpfa *LengthFieldFragmentationAssemblage) Pack(addr string, buffer []byte) (bufs []*bytes.Buffer, e error)

type PacketFragmentationAssembler

type PacketFragmentationAssembler interface {
	Pack(addr string, buffer []byte) (bufs []*bytes.Buffer, e error)
}

type RPCHook

type RPCHook interface {
	DoBeforeRequest(ctx netm.Context, request *protocol.RemotingCommand)
	DoAfterResponse(ctx netm.Context, request *protocol.RemotingCommand, response *protocol.RemotingCommand)
}

RPCHook rpc hook, use send msg

type RemotingClient

type RemotingClient interface {
	InvokeSync(addr string, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)
	InvokeAsync(addr string, request *protocol.RemotingCommand, timeoutMillis int64, invokeCallback InvokeCallback) error
	InvokeOneway(addr string, request *protocol.RemotingCommand, timeoutMillis int64) error
	RegisterProcessor(requestCode int32, processor RequestProcessor)
	RegisterRPCHook(rpcHook RPCHook)
	GetNameServerAddressList() []string
	UpdateNameServerAddressList(addrs []string)
	RegisterContextListener(contextListener netm.ContextListener)
	Start()
	Shutdown()
}

RemotingClient remoting client define

type RemotingServer

type RemotingServer interface {
	InvokeSync(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)
	InvokeAsync(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64, invokeCallback InvokeCallback) error
	InvokeOneway(ctx netm.Context, request *protocol.RemotingCommand, timeoutMillis int64) error
	RegisterProcessor(requestCode int32, processor RequestProcessor)
	RegisterDefaultProcessor(processor RequestProcessor)
	RegisterRPCHook(rpcHook RPCHook)
	RegisterContextListener(contextListener netm.ContextListener)
	Start()
	Shutdown()
}

RemotingServer remoting server define

type RequestProcessor

type RequestProcessor interface {
	ProcessRequest(ctx netm.Context, request *protocol.RemotingCommand) (*protocol.RemotingCommand, error)
}

RequestProcessor request processor

type ResponseFuture

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

ResponseFuture response future

func (*ResponseFuture) GetRemotingCommand

func (responseFuture *ResponseFuture) GetRemotingCommand() *protocol.RemotingCommand

GetRemotingCommand 获取RemotingCommand

func (*ResponseFuture) IsSendRequestOK

func (responseFuture *ResponseFuture) IsSendRequestOK() bool

IsSendRequestOK 是否发送成功

func (*ResponseFuture) IsTimeout

func (responseFuture *ResponseFuture) IsTimeout() bool

IsTimeout 是否超时

func (*ResponseFuture) String

func (r *ResponseFuture) String() string

String 格式化ResponseFuture结构体

Jump to

Keyboard shortcuts

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