Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConn ¶
func NewConn(stream IRPCStream, rwQueueSize int, maxMessageSize uint32) network.IConn
NewConn create websocket conn
func NewServer ¶
func NewServer(conf config.IConfig, agentFunc network.AgentCreateFunc, agentCloseFunc network.AgentCloseFunc) network.IServer
NewServer create grpc server
Types ¶
type Client ¶
type Client struct { sync.Mutex Conf *ClientConfig NewAgent network.AgentCreateFunc CloseAgent network.AgentCloseFunc // contains filtered or unexported fields }
Client grpc client
func NewClient ¶
func NewClient(conf config.IConfig, agentFunc network.AgentCreateFunc, agentCloseFunc network.AgentCloseFunc) *Client
NewClient create grpc client
type ClientConfig ¶
type ClientConfig struct { Nodes []common.NodeInfo `mapstructure:"nodes"` ConnNum int `mapstructure:"conn_num"` ConnectInterval time.Duration `mapstructure:"connect_interval"` SocketQueueSize int `mapstructure:"socket_queue_size"` MaxMessageSize uint32 `mapstructure:"max_message_size"` HandshakeTimeout time.Duration `mapstructure:"handshake_timeout"` AutoReconnect bool `mapstructure:"auto_reconnect"` QueueSize int `mapstructure:"queue_size"` }
ClientConfig grpc client config
func (*ClientConfig) GetQueueSize ¶
func (c *ClientConfig) GetQueueSize() int
GetQueueSize get module queue size
type Conn ¶
Conn grpc conn define
func (*Conn) ReadMessage ¶
ReadMessage goroutine not safe
func (*Conn) WriteMessage ¶
WriteMessage args must not be modified by the others goroutines
type IRPCStream ¶
type IRPCStream interface { Send(*ss.Message) error Recv() (*ss.Message, error) // Context returns the context for this stream. Context() context.Context }
IRPCStream define rpc stream interface
type Server ¶
type Server struct { ss.UnimplementedRPCServer Conf *ServerConfig NewAgent network.AgentCreateFunc CloseAgent network.AgentCloseFunc // contains filtered or unexported fields }
Server grpc server define
type ServerConfig ¶
type ServerConfig struct { Address string `mapstructure:"address"` MaxConnNum int `mapstructure:"max_conn_num"` SocketQueueSize int `mapstructure:"socket_queue_size"` MaxMessageSize uint32 `mapstructure:"max_message_size"` QueueSize int `mapstructure:"queue_size"` }
ServerConfig grpc server config
func (*ServerConfig) GetQueueSize ¶
func (s *ServerConfig) GetQueueSize() int
GetQueueSize get module queue size
Click to show internal directories.
Click to hide internal directories.