Documentation
¶
Overview ¶
Package web implements etcd-play web.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// ErrNoEndpoint is returned when client request has no target endpoint.
ErrNoEndpoint = "no endpoint is given"
)
Functions ¶
This section is empty.
Types ¶
type ClientRequest ¶
type ClientRequest struct {
Action string // 'write', 'stress', 'delete', 'get', 'stop-node', 'restart-node'
RangePrefix bool // 'delete', 'get'
Endpoints []string
KeyValue KeyValue
}
ClientRequest defines client requests.
type ClientResponse ¶
type ClientResponse struct {
ClientRequest ClientRequest
Success bool
Result string
ResultLines []string
KeyValues []KeyValue
}
ClientResponse translates client's GET response in frontend-friendly format.
type Connect ¶
Connect contains initial server state.
type ContextAdapter ¶
type ContextAdapter struct {
// contains filtered or unexported fields
}
ContextAdapter wraps context handler.
func (*ContextAdapter) ServeHTTP ¶
func (ca *ContextAdapter) ServeHTTP(w http.ResponseWriter, req *http.Request)
type ContextHandler ¶
type ContextHandler interface {
ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) error
}
ContextHandler handles ServeHTTP with context.
type ContextHandlerFunc ¶
ContextHandlerFunc defines HandlerFunc function signature to wrap context.
func (ContextHandlerFunc) ServeHTTPContext ¶
func (f ContextHandlerFunc) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, req *http.Request) error
ServeHTTPContext serve HTTP requests with context.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server warps http.Server.
func StartServer ¶
StartServer starts a backend webserver with stoppable listener.
type ServerStatus ¶
type ServerStatus struct {
// PlaygroundActive is true when the user is still active in '/play'.
PlaygroundActive bool
// ServerUptime is the duration since last deploy.
ServerUptime string
// ServerVisits is the number visits since last deploy.
ServerVisits uint64
// UserN is the number of online users.
UserN int
// Users is a slice of users with real IPs being masked.
// Maximum 20 users are returned.
Users []string
// MemberStatuses contains all node statuses.
MemberStatuses []clusterpb.MemberStatus
}
ServerStatus defines server status. Encode without json tags to make it parsable by Typescript.
Source Files
¶
- context.go
- doc.go
- handler.go
- logger.go
- server.go
- utils.go
- utils_id.go
Click to show internal directories.
Click to hide internal directories.