remote

package
v0.0.0-...-9c09a54 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

  • Licensed to the Apache Software Foundation (ASF) under one or more
  • contributor license agreements. See the NOTICE file distributed with
  • this work for additional information regarding copyright ownership.
  • The ASF licenses this file to You under the Apache License, Version 2.0
  • (the "License"); you may not use this file except in compliance with
  • the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • 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.

Package remote is a generated GoMock package.

  • Licensed to the Apache Software Foundation (ASF) under one or more

  • contributor license agreements. See the NOTICE file distributed with

  • this work for additional information regarding copyright ownership.

  • The ASF licenses this file to You under the Apache License, Version 2.0

  • (the "License"); you may not use this file except in compliance with

  • the License. You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • 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.

  • Licensed to the Apache Software Foundation (ASF) under one or more

  • contributor license agreements. See the NOTICE file distributed with

  • this work for additional information regarding copyright ownership.

  • The ASF licenses this file to You under the Apache License, Version 2.0

  • (the "License"); you may not use this file except in compliance with

  • the License. You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • 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 (
	// 0, REQUEST_COMMAND
	RPCType = 0
	// 1, RPC
	RPCOneWay = 1
	//ResponseType for response
	ResponseType = 1
)
View Source
const (
	JsonCodecs     = byte(0)
	RocketMQCodecs = byte(1)
)

Variables

View Source
var DefaultRemotingClientConfig = RemotingClientConfig{defaultTcpOption}

Functions

func ACLInterceptor

func ACLInterceptor(credentials primitive.Credentials) primitive.Interceptor

func NewRemotingClient

func NewRemotingClient(config *RemotingClientConfig) *remotingClient

Types

type ClientRequestFunc

type ClientRequestFunc func(*RemotingCommand, net.Addr) *RemotingCommand

type CustomHeader

type CustomHeader interface {
	Encode() map[string]string
}

type LanguageCode

type LanguageCode byte

func (LanguageCode) MarshalJSON

func (lc LanguageCode) MarshalJSON() ([]byte, error)

func (LanguageCode) String

func (lc LanguageCode) String() string

func (*LanguageCode) UnmarshalJSON

func (lc *LanguageCode) UnmarshalJSON(b []byte) error

type MockRemotingClient

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

MockRemotingClient is a mock of RemotingClient interface

func NewMockRemotingClient

func NewMockRemotingClient(ctrl *gomock.Controller) *MockRemotingClient

NewMockRemotingClient creates a new mock instance

func (*MockRemotingClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockRemotingClient) InvokeAsync

func (m *MockRemotingClient) InvokeAsync(ctx context.Context, addr string, request *RemotingCommand, callback func(*ResponseFuture)) error

InvokeAsync mocks base method

func (*MockRemotingClient) InvokeOneWay

func (m *MockRemotingClient) InvokeOneWay(ctx context.Context, addr string, request *RemotingCommand) error

InvokeOneWay mocks base method

func (*MockRemotingClient) InvokeSync

func (m *MockRemotingClient) InvokeSync(ctx context.Context, addr string, request *RemotingCommand) (*RemotingCommand, error)

InvokeSync mocks base method

func (*MockRemotingClient) RegisterInterceptor

func (m *MockRemotingClient) RegisterInterceptor(interceptors ...primitive.Interceptor)

RegisterInterceptor mocks base method

func (*MockRemotingClient) RegisterRequestFunc

func (m *MockRemotingClient) RegisterRequestFunc(code int16, f ClientRequestFunc)

RegisterRequestFunc mocks base method

func (*MockRemotingClient) ShutDown

func (m *MockRemotingClient) ShutDown()

ShutDown mocks base method

type MockRemotingClientMockRecorder

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

MockRemotingClientMockRecorder is the mock recorder for MockRemotingClient

func (*MockRemotingClientMockRecorder) InvokeAsync

func (mr *MockRemotingClientMockRecorder) InvokeAsync(ctx, addr, request, callback interface{}) *gomock.Call

InvokeAsync indicates an expected call of InvokeAsync

func (*MockRemotingClientMockRecorder) InvokeOneWay

func (mr *MockRemotingClientMockRecorder) InvokeOneWay(ctx, addr, request interface{}) *gomock.Call

InvokeOneWay indicates an expected call of InvokeOneWay

func (*MockRemotingClientMockRecorder) InvokeSync

func (mr *MockRemotingClientMockRecorder) InvokeSync(ctx, addr, request interface{}) *gomock.Call

InvokeSync indicates an expected call of InvokeSync

func (*MockRemotingClientMockRecorder) RegisterInterceptor

func (mr *MockRemotingClientMockRecorder) RegisterInterceptor(interceptors ...interface{}) *gomock.Call

RegisterInterceptor indicates an expected call of RegisterInterceptor

func (*MockRemotingClientMockRecorder) RegisterRequestFunc

func (mr *MockRemotingClientMockRecorder) RegisterRequestFunc(code, f interface{}) *gomock.Call

RegisterRequestFunc indicates an expected call of RegisterRequestFunc

func (*MockRemotingClientMockRecorder) ShutDown

func (mr *MockRemotingClientMockRecorder) ShutDown() *gomock.Call

ShutDown indicates an expected call of ShutDown

type RPCHook

type RPCHook interface {
	DoBeforeRequest(string, *RemotingCommand)
	DoAfterResponse(string, *RemotingCommand)
}

type RemotingClient

type RemotingClient interface {
	RegisterRequestFunc(code int16, f ClientRequestFunc)
	RegisterInterceptor(interceptors ...primitive.Interceptor)
	InvokeSync(ctx context.Context, addr string, request *RemotingCommand) (*RemotingCommand, error)
	InvokeAsync(ctx context.Context, addr string, request *RemotingCommand, callback func(*ResponseFuture)) error
	InvokeOneWay(ctx context.Context, addr string, request *RemotingCommand) error
	ShutDown()
}

type RemotingClientConfig

type RemotingClientConfig struct {
	TcpOption
}

type RemotingCommand

type RemotingCommand struct {
	Code      int16             `json:"code"`
	Language  LanguageCode      `json:"language"`
	Version   int16             `json:"version"`
	Opaque    int32             `json:"opaque"`
	Flag      int32             `json:"flag"`
	Remark    string            `json:"remark"`
	ExtFields map[string]string `json:"extFields"`
	Body      []byte            `json:"-"`
}

func NewRemotingCommand

func NewRemotingCommand(code int16, header CustomHeader, body []byte) *RemotingCommand

func (*RemotingCommand) String

func (command *RemotingCommand) String() string

func (*RemotingCommand) WriteTo

func (command *RemotingCommand) WriteTo(w io.Writer) error

encode RemotingCommand

Frame format: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + item | frame_size | header_length | header_body | body + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + len | 4bytes | 4bytes | (21 + r_len + e_len) bytes | remain bytes + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

type ResponseFuture

type ResponseFuture struct {
	ResponseCommand *RemotingCommand
	Err             error
	Opaque          int32

	Done chan bool
	// contains filtered or unexported fields
}

ResponseFuture

func NewResponseFuture

func NewResponseFuture(ctx context.Context, opaque int32, callback func(*ResponseFuture)) *ResponseFuture

NewResponseFuture create ResponseFuture with opaque, timeout and callback

type TcpOption

type TcpOption struct {
	KeepAliveDuration time.Duration
	ConnectionTimeout time.Duration
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
}

Jump to

Keyboard shortcuts

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