Documentation ¶
Index ¶
- type Client
- func (c *Client) Close()
- func (c *Client) ClosePool(addr string)
- func (c *Client) CloseWithAddr(addr string)
- func (c *Client) Request(op protocol.OpCode, req *protocol.Message) (*protocol.Message, error)
- func (c *Client) RequestTo(addr string, op protocol.OpCode, req *protocol.Message) (*protocol.Message, error)
- type ClientConfig
- type RoundRobin
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client implementation for the internal TCP server. It maintains a connection pool and manages request-response cycle.
func (*Client) ClosePool ¶
ClosePool closes the underlying connections in a pool, deletes from Olric's pools map and frees resources.
func (*Client) CloseWithAddr ¶
CloseWithAddr closes the connection for given addr, if any exists.
type ClientConfig ¶
type ClientConfig struct { Addrs []string DialTimeout time.Duration KeepAlive time.Duration MinConn int MaxConn int }
ClientConfig configuration parameters of the client.
type RoundRobin ¶
RoundRobin implements quite simple round-robin algorithm to distribute load fairly between servers.
func NewRoundRobin ¶
func NewRoundRobin(addrs []string) *RoundRobin
NewRoundRobin returns a new RoundRobin.
type Server ¶
type Server struct { StartCh chan struct{} // contains filtered or unexported fields }
Server implements a concurrent TCP server.
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address addr.
func (*Server) SetDispatcher ¶
func (*Server) Shutdown ¶
Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first closing all open listeners, then closing all idle connections, and then waiting indefinitely for connections to return to idle and then shut down. If the provided context expires before the shutdown is complete, Shutdown returns the context's error, otherwise it returns any error returned from closing the Server's underlying Listener(s).