Documentation ¶
Index ¶
- Constants
- func SetClientConf(c ClientConfig)
- func SetServerConfig(s ServerConfig)
- type Client
- type ClientConfig
- type GettySessionParam
- type Options
- 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 Server
- type ServerConfig
Constants ¶
const (
TCPReadWriteTimeoutMinValue = time.Second * 1
)
const ( // WritePkg_Timeout the timeout of write pkg WritePkg_Timeout = 5 * time.Second )
todo: WritePkg_Timeout will entry *.yml
Variables ¶
This section is empty.
Functions ¶
func SetServerConfig ¶
func SetServerConfig(s ServerConfig)
SetServerConfig set dubbo server config.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client : some configuration for network communication.
func (*Client) IsAvailable ¶
IsAvailable returns true if the connection is available, or it can be re-established.
func (*Client) Request ¶
func (c *Client) Request(request *remoting.Request, timeout time.Duration, response *remoting.PendingResponse) error
Request send request
func (*Client) SetExchangeClient ¶
func (c *Client) SetExchangeClient(client *remoting.ExchangeClient)
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:"60s" yaml:"heartbeat-period" json:"heartbeat-period,omitempty"` // heartbeat timeout HeartbeatTimeout string `default:"5s" yaml:"heartbeat-timeout" json:"heartbeat-timeout,omitempty"` // session SessionTimeout string `default:"60s" yaml:"session-timeout" json:"session-timeout,omitempty"` // gr pool 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:",inline" json:",inline"` // contains filtered or unexported fields }
ClientConfig holds supported types by the multi config package
func GetDefaultClientConfig ¶
func GetDefaultClientConfig() *ClientConfig
GetDefaultClientConfig gets client default configuration
func (*ClientConfig) CheckValidity ¶
func (c *ClientConfig) CheckValidity() error
CheckValidity confirm client params.
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"` 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 is session configuration for getty
func (*GettySessionParam) CheckValidity ¶
func (c *GettySessionParam) CheckValidity() error
CheckValidity confirm getty session params
type Options ¶
type Options struct { // connect timeout // remove request timeout, it will be calculate for every request ConnectTimeout time.Duration // request timeout RequestTimeout time.Duration }
Options : param config
type RpcClientHandler ¶
type RpcClientHandler struct {
// contains filtered or unexported fields
}
nolint
func NewRpcClientHandler ¶
func NewRpcClientHandler(client *gettyRPCClient) *RpcClientHandler
nolint
func (*RpcClientHandler) OnClose ¶
func (h *RpcClientHandler) OnClose(session getty.Session)
OnClose close the session, remove it from the getty session list
func (*RpcClientHandler) OnCron ¶
func (h *RpcClientHandler) OnCron(session getty.Session)
OnCron check the session health periodic. if the session's sessionTimeout has reached, just close the session
func (*RpcClientHandler) OnError ¶
func (h *RpcClientHandler) OnError(session getty.Session, err error)
OnError the getty client session has errored, so remove the session from the getty client session list
func (*RpcClientHandler) OnMessage ¶
func (h *RpcClientHandler) OnMessage(session getty.Session, pkg interface{})
OnMessage get response from getty server, and update the session to the getty client session list
type RpcClientPackageHandler ¶
type RpcClientPackageHandler struct {
// contains filtered or unexported fields
}
RpcClientPackageHandler Read data from server and Write data to server
func NewRpcClientPackageHandler ¶
func NewRpcClientPackageHandler(client *Client) *RpcClientPackageHandler
NewRpcClientPackageHandler create a RpcClientPackageHandler
type RpcServerHandler ¶
type RpcServerHandler struct {
// contains filtered or unexported fields
}
nolint
func NewRpcServerHandler ¶
func NewRpcServerHandler(maxSessionNum int, sessionTimeout time.Duration, serverP *Server) *RpcServerHandler
nolint
func (*RpcServerHandler) OnClose ¶
func (h *RpcServerHandler) OnClose(session getty.Session)
OnClose close the session, remove it from the getty server list
func (*RpcServerHandler) OnCron ¶
func (h *RpcServerHandler) OnCron(session getty.Session)
OnCron check the session health periodic. if the session's sessionTimeout has reached, just close the session
func (*RpcServerHandler) OnError ¶
func (h *RpcServerHandler) OnError(session getty.Session, err error)
OnError the getty server session has errored, so remove the session from the getty server session list
func (*RpcServerHandler) OnMessage ¶
func (h *RpcServerHandler) OnMessage(session getty.Session, pkg interface{})
OnMessage get request from getty client, update the session reqNum and reply response to client
type RpcServerPackageHandler ¶
type RpcServerPackageHandler struct {
// contains filtered or unexported fields
}
RpcServerPackageHandler Read data from client and Write data to client
func NewRpcServerPackageHandler ¶
func NewRpcServerPackageHandler(server *Server) *RpcServerPackageHandler
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server define getty server
func NewServer ¶
func NewServer(url *common.URL, handlers func(*invocation.RPCInvocation) protocol.RPCResult) *Server
NewServer create a new Server
type ServerConfig ¶
type ServerConfig struct { SSLEnabled bool // heartbeat HeartbeatPeriod string `default:"60s" yaml:"heartbeat-period" json:"heartbeat-period,omitempty"` // heartbeat timeout HeartbeatTimeout string `default:"5s" yaml:"heartbeat-timeout" json:"heartbeat-timeout,omitempty"` // session SessionTimeout string `default:"60s" yaml:"session-timeout" json:"session-timeout,omitempty"` SessionNumber int `default:"1000" yaml:"session-number" json:"session-number,omitempty"` // gr pool 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:",inline" json:",inline"` // contains filtered or unexported fields }
ServerConfig holds supported types by the multiconfig package
func GetDefaultServerConfig ¶
func GetDefaultServerConfig() *ServerConfig
GetDefaultServerConfig gets server default configuration
func (*ServerConfig) CheckValidity ¶
func (c *ServerConfig) CheckValidity() error
CheckValidity confirm server params