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
- type BaseRemotingAchieve
- func (ra *BaseRemotingAchieve) RegisterProcessor(requestCode int32, processor RequestProcessor)
- func (ra *BaseRemotingAchieve) RegisterRPCHook(rpcHook RPCHook)
- func (ra *BaseRemotingAchieve) SetContextEventListener(contextEventListener ContextEventListener)
- func (ra *BaseRemotingAchieve) SetDefaultProcessor(processor RequestProcessor)
- type ContextEventListener
- type InvokeCallback
- type LengthFieldFragmentationAssemblage
- type NMRemotingClient
- func (rc *NMRemotingClient) GetNameServerAddressList() []string
- func (rc *NMRemotingClient) InvokeAsync(addr string, request *protocol.RemotingCommand, timeoutMillis int64, ...) error
- func (rc *NMRemotingClient) InvokeOneway(addr string, request *protocol.RemotingCommand, timeoutMillis int64) error
- func (rc *NMRemotingClient) InvokeSync(addr string, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)
- func (rc *NMRemotingClient) Shutdown()
- func (rc *NMRemotingClient) Start()
- func (rc *NMRemotingClient) UpdateNameServerAddressList(addrs []string)
- type NMRemotingServer
- func (rs *NMRemotingServer) InvokeAsync(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64, ...) error
- func (rs *NMRemotingServer) InvokeOneway(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64) error
- func (rs *NMRemotingServer) InvokeSync(ctx core.Context, request *protocol.RemotingCommand, timeoutMillis int64) (*protocol.RemotingCommand, error)
- func (rs *NMRemotingServer) ListenPort() int
- func (rs *NMRemotingServer) Shutdown()
- func (rs *NMRemotingServer) Start()
- type PacketFragmentationAssembler
- type RPCHook
- type RemotingClient
- type RemotingServer
- type RequestProcessor
- type ResponseFuture
Constants ¶
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) 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
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结构体字符串