Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( MetricConnectionsEstablishedExt = metrics.AddCounter("conn_established_ext", nil) MetricConnectionsEstablishedL1 = metrics.AddCounter("conn_established_l1", nil) MetricConnectionsEstablishedL2 = metrics.AddCounter("conn_established_l2", nil) MetricProtocolsAssigned = metrics.AddCounter("protocols_assigned", nil) MetricProtocolsAssignedError = metrics.AddCounter("protocols_assigned_error", nil) MetricProtocolsAssignedErrorEOF = metrics.AddCounter("protocols_assigned_error_eof", nil) MetricProtocolsAssignedFallback = metrics.AddCounter("protocols_assigned_fallback", nil) MetricCmdTotal = metrics.AddCounter("cmd_total", nil) MetricErrAppError = metrics.AddCounter("err_app_err", nil) MetricErrUnrecoverable = metrics.AddCounter("err_unrecoverable", nil) MetricCmdGet = metrics.AddCounter("cmd_get", nil) MetricCmdGetE = metrics.AddCounter("cmd_gete", nil) MetricCmdSet = metrics.AddCounter("cmd_set", nil) MetricCmdAdd = metrics.AddCounter("cmd_add", nil) MetricCmdReplace = metrics.AddCounter("cmd_replace", nil) MetricCmdAppend = metrics.AddCounter("cmd_append", nil) MetricCmdPrepend = metrics.AddCounter("cmd_prepend", nil) MetricCmdDelete = metrics.AddCounter("cmd_delete", nil) MetricCmdTouch = metrics.AddCounter("cmd_touch", nil) MetricCmdGat = metrics.AddCounter("cmd_gat", nil) MetricCmdUnknown = metrics.AddCounter("cmd_unknown", nil) MetricCmdNoop = metrics.AddCounter("cmd_noop", nil) MetricCmdQuit = metrics.AddCounter("cmd_quit", nil) MetricCmdVersion = metrics.AddCounter("cmd_version", nil) HistSet = metrics.AddHistogram("set", false, nil) HistAdd = metrics.AddHistogram("add", false, nil) HistReplace = metrics.AddHistogram("replace", false, nil) HistAppend = metrics.AddHistogram("append", false, nil) HistPrepend = metrics.AddHistogram("prepend", false, nil) HistDelete = metrics.AddHistogram("delete", false, nil) HistTouch = metrics.AddHistogram("touch", false, nil) HistGet = metrics.AddHistogram("get", false, nil) // not sampled until configurable HistGetE = metrics.AddHistogram("gete", false, nil) // not sampled until configurable HistGat = metrics.AddHistogram("gat", false, nil) // not sampled until configurable )
Functions ¶
func ListenAndServe ¶
func ListenAndServe(l ListenConst, ps []protocol.Components, s ServerConst, o orcas.OrcaConst, h1, h2 handlers.HandlerConst)
ListenAndServe is the main accept() loop of a server. It will use all of the components passed in to construct a full set of components to serve a connection when the connection gets established.
Arguments:
l ListenArgs:
- Determines what protocol to listen on and where to listen, e.g. tcp port 11211 or unix domain socket /tmp/foo.sock
ps []protocol.Components
- Used to determine what protocol to use on the connection. The protocols' disambiguators are used *in order*, so protocols that are first will get priority if multiple can parse the same connection.
s server.ServerConst
- Used to create the server.Server instance as needed when the connection is established.
o orcas.OrcaConst
- Used to create the orcas.Orca instance as needed when the connection is established.
h1, h2 handlers.HandlerConst
- Used to create the handlers.Handler instances as needed when the connection is established.
Types ¶
type DefaultServer ¶
type DefaultServer struct {
// contains filtered or unexported fields
}
DefaultServer is the default server implementation that implements a server REPL for a single external connection.
func (*DefaultServer) Loop ¶
func (s *DefaultServer) Loop()
Loop acts as a master loop for the connection that it is given. Requests are read using the given protocol.RequestParser and performed by the given orcas.Orca. The connections will all be closed upon an unrecoverable error.
type ListenConst ¶
ListenConst is a constructor function for listener implementations
func TCPListener ¶
func TCPListener(port int) ListenConst
TCPListener is a ListenConst that returns a tcp listener for the given port
func UnixListener ¶
func UnixListener(path string) ListenConst
UnixListener is a ListenConst that returns a unix domain socket listener for the given path
type Server ¶
type Server interface { // Loop is intended to be an infinite loop serving a single connection which will only return when // the connection is done being serviced. The server implementations should be able to runn a single // connection based on the parameters of the ServerConst that created it. Loop() }
Server is the interface that ServerConst returns.
type ServerConst ¶
ServerConst is a constructor function for servers. Each server implementation should have a corresponding ServerConst to create it.