admin

package
v0.0.0-...-6a6d86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2015 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const EventsQueryKey = "e"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Type APIErrorType `json:"type"`
	Msg  string       `json:"msg"`
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) String

func (e *APIError) String() string

type APIErrorType

type APIErrorType string

type CreateMountIn

type CreateMountIn struct {
	FsParams FsParams `json:"fs_params"`
	FsType   string   `json:"fs_type"`
	Source   string   `json:"source"`
	Target   string   `json:"target"`
}

type CreateRandomServerIn

type CreateRandomServerIn struct {
	BindAddress string `json:"bind_address"`
}

type CreateServerIn

type CreateServerIn struct {
	BindAddress string `json:"bind_address"`
}

type Event

type Event struct {
	Type     EventType
	Resource interface{}
}

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(b []byte) error

type EventType

type EventType int
const (
	EventTypeServerAdd EventType = 1 + iota
	EventTypeServerRemove
	EventTypeMountAdd
	EventTypeMountUpdate
	EventTypeMountRemove
	EventTypeFileServe
)

type FileServeEvent

type FileServeEvent struct {
	Server Server `json:"server"`
	Path   string `json:"path"`
	Code   int    `json:"code"`
}

type FsParams

type FsParams fileserver.Params

type GorillaRouter

type GorillaRouter struct {
	Router  *mux.Router
	BaseURL *url.URL
}

func (*GorillaRouter) GetRouteParam

func (gr *GorillaRouter) GetRouteParam(r *http.Request, name string) string

func (*GorillaRouter) RegisterHandler

func (gr *GorillaRouter) RegisterHandler(routeName string, handler http.Handler)

func (*GorillaRouter) RegisterRoute

func (gr *GorillaRouter) RegisterRoute(path string, name string)

func (*GorillaRouter) ReverseRoute

func (gr *GorillaRouter) ReverseRoute(name string, params ...string) *url.URL

func (*GorillaRouter) ServeHTTP

func (gr *GorillaRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HTTPDecoder

type HTTPDecoder interface {
	Decode(http.ResponseWriter, *http.Request, interface{}) error
}

HTTPDecoder is the interface implemented by objects that can decode data received from a http request.

Implementors have to close the request.Body. Decode() shouldn't write to http.ResponseWriter: it's up to the caller to e.g, handle errors.

type HTTPEncoder

type HTTPEncoder interface {
	Encode(w http.ResponseWriter, r *http.Request, data interface{}, code int) error
}

HTTPEncoder is the interface implemented by objects that can encode values to a http response, with the specified http status.

Implementors must handle nil data.

type HandlerRegisterer

type HandlerRegisterer interface {
	RegisterHandler(routeName string, handler http.Handler)
}

HandlerRegisterer is the interface implemented by objects that can register a http handler for an http route.

type JSONCodec

type JSONCodec struct {
}

func (*JSONCodec) Decode

func (j *JSONCodec) Decode(w http.ResponseWriter, r *http.Request, data interface{}) error

func (*JSONCodec) Encode

func (j *JSONCodec) Encode(w http.ResponseWriter, r *http.Request, data interface{}, code int) error

type MethodHandler

type MethodHandler struct {
	Get, Head, Post, Put, Patch, Delete, Options http.Handler
}

MethodHandler is an http.Handler that dispatches to a handler whose field name matches the name of the HTTP request's method, eg: GET

If the request's method is OPTIONS and Options is not set, then the handler responds with a status of 200 and sets the Allow header to a comma-separated list of available methods.

If the request's method has no handler for it, the MethodHandler responds with a status of 405, Method not allowed and sets the Allow header to a comma-separated list of available methods.

func (MethodHandler) ServeHTTP

func (h MethodHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Mount

type Mount struct {
	Id     string `json:"id"`
	Source string `json:"source"`
	Target string `json:"target"`
}

type MountEvent

type MountEvent struct {
	Server Server `json:"server"`
	Mount  Mount  `json:"mount"`
}

type RouteEvents

type RouteEvents struct{}

func (RouteEvents) Location

func (r RouteEvents) Location(rr RouteReverser) *url.URL

type RouteFileservers

type RouteFileservers struct{}

func (RouteFileservers) Location

func (r RouteFileservers) Location(rr RouteReverser) *url.URL

type RouteLocation

type RouteLocation interface {
	Location(RouteReverser) *url.URL
}

RouteLocation is the interface implemented by objects that can return an url for a route, using a RouteReverser.

type RouteParamGetter

type RouteParamGetter interface {
	GetRouteParam(r *http.Request, name string) string
}

RouteParamGetter is the interface implemented by objects that can retrieve the value of a parameter of a route, by name.

type RouteRegisterer

type RouteRegisterer interface {
	RegisterRoute(path string, name string)
}

RouteRegisterer is the interface implemented by objects that can register a name for a route path.

type RouteReverser

type RouteReverser interface {
	ReverseRoute(name string, params ...string) *url.URL
}

RouteReverser is the interface implemented by objects that can retrieve the url of a route based on its registered name and the route param names and values.

func NewServerPoolRoutes

func NewServerPoolRoutes(baseURL *url.URL) RouteReverser

type RouteServers

type RouteServers struct{}

func (RouteServers) Location

func (r RouteServers) Location(rr RouteReverser) *url.URL

type RouteServersOne

type RouteServersOne struct {
	ServerPort string
}

func (RouteServersOne) Location

func (r RouteServersOne) Location(rr RouteReverser) *url.URL

type RouteServersOneMounts

type RouteServersOneMounts struct {
	ServerPort string
}

func (RouteServersOneMounts) Location

func (r RouteServersOneMounts) Location(rr RouteReverser) *url.URL

type RouteServersOneMountsOne

type RouteServersOneMountsOne struct {
	ServerPort string
	MountId    string
}

func (RouteServersOneMountsOne) Location

type Server

type Server struct {
	BindAddress string  `json:"bind_address"`
	Mounts      []Mount `json:"mounts"`
	Port        int     `json:"port"`
}

type ServerEvent

type ServerEvent struct {
	Server Server `json:"server"`
}

type ServerPoolHandler

type ServerPoolHandler struct {
	*kraken.ServerPool
	Log *log.Logger
	// contains filtered or unexported fields
}

func NewServerPoolHandler

func NewServerPoolHandler(serverPool *kraken.ServerPool, baseURL *url.URL) *ServerPoolHandler

func (*ServerPoolHandler) BaseURL

func (sph *ServerPoolHandler) BaseURL() *url.URL

func (*ServerPoolHandler) ServeHTTP

func (sph *ServerPoolHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL