Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CommandsTotal is total number of all requests broken down by command (get, put, etc.) and status. CommandsTotal = stats.NewInt64Counter() // ConnectionsTotal is total number of connections opened since the server started running. ConnectionsTotal = stats.NewInt64Counter() // CurrentConnections is current number of open connections. CurrentConnections = stats.NewInt64Gauge() // WrittenBytesTotal is total number of bytes sent by this server to network. WrittenBytesTotal = stats.NewInt64Counter() // ReadBytesTotal is total number of bytes read by this server from network. ReadBytesTotal = stats.NewInt64Counter() )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { BindAddr string BindPort int KeepAlivePeriod time.Duration IdleClose time.Duration }
Config is a composite type to bundle configuration parameters.
type ConnWrapper ¶
type HandlerFunc ¶
The HandlerFunc type is an adapter to allow the use of ordinary functions as RESP handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.
type ListenerWrapper ¶
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
ServeMux is an RESP command multiplexer.
func (*ServeMux) Handle ¶
Handle registers the handler for the given command. If a handler already exists for command, Handle panics.
func (*ServeMux) HandleFunc ¶
HandleFunc registers the handler function for the given command.
type ServeMuxWrapper ¶
type ServeMuxWrapper struct {
// contains filtered or unexported fields
}
func (*ServeMuxWrapper) HandleFunc ¶
func (m *ServeMuxWrapper) HandleFunc(command string, handler func(conn redcon.Conn, cmd redcon.Command))
HandleFunc registers the handler function for the given command.
type Server ¶
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address addr.
func (*Server) ServeMux ¶
func (s *Server) ServeMux() *ServeMuxWrapper
func (*Server) SetPreConditionFunc ¶
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).