remoting

package
v0.0.0-...-d86056c Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2018 License: Apache-2.0 Imports: 10 Imported by: 7

Documentation

Overview

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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
}

BaseRemotingAchieve bae remoting achive, basic func impl.

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

func (*BaseRemotingAchieve) SetContextEventListener

func (ra *BaseRemotingAchieve) SetContextEventListener(contextEventListener ContextEventListener)

SetContextEventListener 设置事件监听

func (*BaseRemotingAchieve) SetDefaultProcessor

func (ra *BaseRemotingAchieve) SetDefaultProcessor(processor RequestProcessor)

SetDefaultProcessor set default porcessor

type ContextEventListener

type ContextEventListener interface {
	OnContextIdle(ctx core.Context)
	core.EventListener
}

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 core.SocketAddr, buffer []byte) (bufs []*bytes.Buffer, e error)

type NMRemotingClient

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

NMRemotingClient net manage remoting client

func NewNMRemotingClient

func NewNMRemotingClient() *NMRemotingClient

NewNMRemotingClient return new net remoting client

func (*NMRemotingClient) GetNameServerAddressList

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

GetNameServerAddressList return nameserver addr list

func (*NMRemotingClient) InvokeAsync

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

InvokeAsync 异步调用

func (*NMRemotingClient) InvokeOneway

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

InvokeSync 单向发送消息

func (*NMRemotingClient) InvokeSync

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

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

func (*NMRemotingClient) Shutdown

func (rc *NMRemotingClient) Shutdown()

Shutdown shutdown client

func (*NMRemotingClient) Start

func (rc *NMRemotingClient) Start()

Start start client

func (*NMRemotingClient) UpdateNameServerAddressList

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

UpdateNameServerAddressList update nameserver addrs list

type NMRemotingServer

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

NMRemotingServer net remoting server

func NewNMRemotingServer

func NewNMRemotingServer(host string, port int) *NMRemotingServer

NewNMRemotingServer return new default remoting server

func (*NMRemotingServer) InvokeAsync

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

InvokeAsync 异步调用

func (*NMRemotingServer) InvokeOneway

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

InvokeSync 单向发送消息

func (*NMRemotingServer) InvokeSync

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

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

func (*NMRemotingServer) ListenPort

func (rs *NMRemotingServer) ListenPort() int

func (*NMRemotingServer) Shutdown

func (rs *NMRemotingServer) Shutdown()

Shutdown shutdown server

func (*NMRemotingServer) Start

func (rs *NMRemotingServer) Start()

Start start server

type PacketFragmentationAssembler

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

type RPCHook

type RPCHook interface {
	DoBeforeRequest(ctx core.Context, request *protocol.RemotingCommand)
	DoAfterResponse(ctx core.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)
	SetContextEventListener(contextEventListener ContextEventListener)
	Start()
	Shutdown()
}

RemotingClient remoting client define

type RemotingServer

type RemotingServer interface {
	InvokeSync(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)
	InvokeAsync(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64, invokeCallback InvokeCallback) error
	InvokeOneway(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64) error
	RegisterProcessor(requestCode int32, processor RequestProcessor)
	SetDefaultProcessor(processor RequestProcessor)
	RegisterRPCHook(rpcHook RPCHook)
	SetContextEventListener(contextEventListener ContextEventListener)
	ListenPort() int
	Start()
	Shutdown()
}

RemotingServer remoting server define

type RequestProcessor

type RequestProcessor interface {
	ProcessRequest(ctx core.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