Documentation
¶
Index ¶
- Constants
- Variables
- func GetProtocol() protocol.Protocol
- func SetClientConf(c ClientConfig)
- func SetServerConfig(s ServerConfig)
- func SetServerGrpool()
- type AsyncCallbackResponse
- type CallType
- type Client
- type ClientConfig
- type DubboExporter
- type DubboInvoker
- type DubboPackage
- type DubboProtocol
- type GettySessionParam
- type Options
- type PendingResponse
- type Request
- type Response
- type RpcClientHandler
- func (h *RpcClientHandler) OnClose(session getty.Session)
- func (h *RpcClientHandler) OnCron(session getty.Session)
- func (h *RpcClientHandler) OnError(session getty.Session, err error)
- func (h *RpcClientHandler) OnMessage(session getty.Session, pkg interface{})
- func (h *RpcClientHandler) OnOpen(session getty.Session) error
- type RpcClientPackageHandler
- type RpcServerHandler
- func (h *RpcServerHandler) OnClose(session getty.Session)
- func (h *RpcServerHandler) OnCron(session getty.Session)
- func (h *RpcServerHandler) OnError(session getty.Session, err error)
- func (h *RpcServerHandler) OnMessage(session getty.Session, pkg interface{})
- func (h *RpcServerHandler) OnOpen(session getty.Session) error
- type RpcServerPackageHandler
- type SequenceType
- type SerialID
- type Server
- type ServerConfig
Constants ¶
const (
// DUBBO ...
DUBBO = "dubbo"
)
dubbo protocol constant
const ( // WritePkg_Timeout ... WritePkg_Timeout = 5 * time.Second )
todo: WritePkg_Timeout will entry *.yml
Variables ¶
var ( // ErrNoReply ... ErrNoReply = perrors.New("request need @response") ErrDestroyedInvoker = perrors.New("request Destroyed invoker") )
Functions ¶
Types ¶
type AsyncCallbackResponse ¶ added in v1.3.0
type AsyncCallbackResponse struct {
common.CallbackResponse
Opts Options
Cause error
Start time.Time // invoke(call) start time == write start time
ReadStart time.Time // read start time, write duration = ReadStart - Start
Reply interface{}
}
AsyncCallbackResponse async response for dubbo
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client ...
func (*Client) AsyncCall ¶
func (c *Client) AsyncCall(request *Request, callback common.AsyncCallback, response *Response) error
AsyncCall ...
func (*Client) Call ¶
Call if @response is nil, the transport layer will get the response without notify the invoker.
func (*Client) CallOneway ¶
CallOneway call one way
type ClientConfig ¶
type ClientConfig struct {
ReconnectInterval int `default:"0" yaml:"reconnect_interval" json:"reconnect_interval,omitempty"`
// session pool
ConnectionNum int `default:"16" yaml:"connection_number" json:"connection_number,omitempty"`
// heartbeat
HeartbeatPeriod string `default:"15s" yaml:"heartbeat_period" json:"heartbeat_period,omitempty"`
// session
SessionTimeout string `default:"60s" yaml:"session_timeout" json:"session_timeout,omitempty"`
// Connection Pool
PoolSize int `default:"2" yaml:"pool_size" json:"pool_size,omitempty"`
PoolTTL int `default:"180" yaml:"pool_ttl" json:"pool_ttl,omitempty"`
// grpool
GrPoolSize int `default:"0" yaml:"gr_pool_size" json:"gr_pool_size,omitempty"`
QueueLen int `default:"0" yaml:"queue_len" json:"queue_len,omitempty"`
QueueNumber int `default:"0" yaml:"queue_number" json:"queue_number,omitempty"`
// session tcp parameters
GettySessionParam GettySessionParam `required:"true" yaml:"getty_session_param" json:"getty_session_param,omitempty"`
// contains filtered or unexported fields
}
ClientConfig Config holds supported types by the multiconfig package
func GetDefaultClientConfig ¶ added in v1.2.0
func GetDefaultClientConfig() ClientConfig
GetDefaultClientConfig ...
type DubboExporter ¶
type DubboExporter struct {
protocol.BaseExporter
}
DubboExporter ...
func NewDubboExporter ¶
NewDubboExporter ...
type DubboInvoker ¶
type DubboInvoker struct {
protocol.BaseInvoker
// contains filtered or unexported fields
}
DubboInvoker ...
func NewDubboInvoker ¶
func NewDubboInvoker(url common.URL, client *Client) *DubboInvoker
NewDubboInvoker ...
func (*DubboInvoker) Invoke ¶
func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result
Invoke ...
type DubboPackage ¶
type DubboPackage struct {
Header hessian.DubboHeader
Service hessian.Service
Body interface{}
Err error
}
DubboPackage ...
func (DubboPackage) String ¶
func (p DubboPackage) String() string
type DubboProtocol ¶
type DubboProtocol struct {
protocol.BaseProtocol
// contains filtered or unexported fields
}
DubboProtocol ...
type GettySessionParam ¶
type GettySessionParam struct {
CompressEncoding bool `default:"false" yaml:"compress_encoding" json:"compress_encoding,omitempty"`
TcpNoDelay bool `default:"true" yaml:"tcp_no_delay" json:"tcp_no_delay,omitempty"`
TcpKeepAlive bool `default:"true" yaml:"tcp_keep_alive" json:"tcp_keep_alive,omitempty"`
KeepAlivePeriod string `default:"180s" yaml:"keep_alive_period" json:"keep_alive_period,omitempty"`
TcpRBufSize int `default:"262144" yaml:"tcp_r_buf_size" json:"tcp_r_buf_size,omitempty"`
TcpWBufSize int `default:"65536" yaml:"tcp_w_buf_size" json:"tcp_w_buf_size,omitempty"`
PkgWQSize int `default:"1024" yaml:"pkg_wq_size" json:"pkg_wq_size,omitempty"`
TcpReadTimeout string `default:"1s" yaml:"tcp_read_timeout" json:"tcp_read_timeout,omitempty"`
TcpWriteTimeout string `default:"5s" yaml:"tcp_write_timeout" json:"tcp_write_timeout,omitempty"`
WaitTimeout string `default:"7s" yaml:"wait_timeout" json:"wait_timeout,omitempty"`
MaxMsgLen int `default:"1024" yaml:"max_msg_len" json:"max_msg_len,omitempty"`
SessionName string `default:"rpc" yaml:"session_name" json:"session_name,omitempty"`
// contains filtered or unexported fields
}
GettySessionParam ...
func (*GettySessionParam) CheckValidity ¶
func (c *GettySessionParam) CheckValidity() error
CheckValidity ...
type Options ¶ added in v1.2.0
type Options struct {
// connect timeout
ConnectTimeout time.Duration
// request timeout
RequestTimeout time.Duration
}
Options ...
type PendingResponse ¶
type PendingResponse struct {
// contains filtered or unexported fields
}
PendingResponse ...
func (PendingResponse) GetCallResponse ¶
func (r PendingResponse) GetCallResponse() common.CallbackResponse
GetCallResponse ...
type Request ¶ added in v1.2.0
type Request struct {
// contains filtered or unexported fields
}
Request ...
type Response ¶ added in v1.2.0
type Response struct {
// contains filtered or unexported fields
}
Response ...
func NewResponse ¶ added in v1.2.0
NewResponse ...
type RpcClientHandler ¶
type RpcClientHandler struct {
// contains filtered or unexported fields
}
RpcClientHandler ...
func NewRpcClientHandler ¶
func NewRpcClientHandler(client *gettyRPCClient) *RpcClientHandler
NewRpcClientHandler ...
func (*RpcClientHandler) OnClose ¶
func (h *RpcClientHandler) OnClose(session getty.Session)
OnClose ...
func (*RpcClientHandler) OnCron ¶
func (h *RpcClientHandler) OnCron(session getty.Session)
OnCron ...
func (*RpcClientHandler) OnError ¶
func (h *RpcClientHandler) OnError(session getty.Session, err error)
OnError ...
func (*RpcClientHandler) OnMessage ¶
func (h *RpcClientHandler) OnMessage(session getty.Session, pkg interface{})
OnMessage ...
type RpcClientPackageHandler ¶
type RpcClientPackageHandler struct {
// contains filtered or unexported fields
}
RpcClientPackageHandler ...
func NewRpcClientPackageHandler ¶
func NewRpcClientPackageHandler(client *Client) *RpcClientPackageHandler
NewRpcClientPackageHandler ...
type RpcServerHandler ¶
type RpcServerHandler struct {
// contains filtered or unexported fields
}
RpcServerHandler ...
func NewRpcServerHandler ¶
func NewRpcServerHandler(maxSessionNum int, sessionTimeout time.Duration) *RpcServerHandler
NewRpcServerHandler ...
func (*RpcServerHandler) OnClose ¶
func (h *RpcServerHandler) OnClose(session getty.Session)
OnClose ...
func (*RpcServerHandler) OnCron ¶
func (h *RpcServerHandler) OnCron(session getty.Session)
OnCron ...
func (*RpcServerHandler) OnError ¶
func (h *RpcServerHandler) OnError(session getty.Session, err error)
OnError ...
func (*RpcServerHandler) OnMessage ¶
func (h *RpcServerHandler) OnMessage(session getty.Session, pkg interface{})
OnMessage ...
type RpcServerPackageHandler ¶
type RpcServerPackageHandler struct{}
RpcServerPackageHandler ...
type SerialID ¶
type SerialID byte
SerialID serial ID
const ( // S_Dubbo dubbo serial id S_Dubbo SerialID = 2 )
type ServerConfig ¶
type ServerConfig struct {
// session
SessionTimeout string `default:"60s" yaml:"session_timeout" json:"session_timeout,omitempty"`
SessionNumber int `default:"1000" yaml:"session_number" json:"session_number,omitempty"`
// grpool
GrPoolSize int `default:"0" yaml:"gr_pool_size" json:"gr_pool_size,omitempty"`
QueueLen int `default:"0" yaml:"queue_len" json:"queue_len,omitempty"`
QueueNumber int `default:"0" yaml:"queue_number" json:"queue_number,omitempty"`
// session tcp parameters
GettySessionParam GettySessionParam `required:"true" yaml:"getty_session_param" json:"getty_session_param,omitempty"`
// contains filtered or unexported fields
}
ServerConfig Config holds supported types by the multiconfig package
func GetDefaultServerConfig ¶ added in v1.2.0
func GetDefaultServerConfig() ServerConfig
GetDefaultServerConfig ...