server

package
v0.0.0-...-49ede41 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2017 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StoppedError = errors.New("Server listener stopped")

Functions

This section is empty.

Types

type ServerInfo

type ServerInfo struct {
	Status     string `json:"status"`
	ServerAddr string `json:"server_addr"`
	Keys       int    `json:"keys"`
}

type ServerListener

type ServerListener struct {
	*net.TCPListener // Backing TCP listener

	Open bool // Indicator that this listener opened or not
	// contains filtered or unexported fields
}

Custom TCP listener that could receive stop signal inspired by http://www.hydrogen18.com/blog/stop-listening-http-server-go.html

func NewTCPListener

func NewTCPListener(l net.Listener) (*ServerListener, error)

func (*ServerListener) Accept

func (sl *ServerListener) Accept() (net.Conn, error)

Override accept method of backed listener

func (*ServerListener) Close

func (sl *ServerListener) Close() error

type ServerRouter

type ServerRouter struct {
	Configuration  *configs.Config
	Mux            *mux.Router
	Database       *collection.Collection
	ServerInfo     *ServerInfo
	ServerListener *ServerListener
}

func NewRouter

func NewRouter(config *configs.Config, database *collection.Collection) *ServerRouter

func (*ServerRouter) CreateOrUpdateDocument

func (sr *ServerRouter) CreateOrUpdateDocument(
	w http.ResponseWriter,
	r *http.Request)

func (*ServerRouter) DeleteDocument

func (sr *ServerRouter) DeleteDocument(
	w http.ResponseWriter,
	r *http.Request)

func (*ServerRouter) GetDocument

func (sr *ServerRouter) GetDocument(
	w http.ResponseWriter,
	r *http.Request)

func (*ServerRouter) GetServer

func (sr *ServerRouter) GetServer(
	w http.ResponseWriter,
	r *http.Request)

func (*ServerRouter) Index

func (sr *ServerRouter) Index(w http.ResponseWriter, r *http.Request)

func (*ServerRouter) NotSupported

func (sr *ServerRouter) NotSupported(
	w http.ResponseWriter,
	r *http.Request)

func (*ServerRouter) SetupRoutes

func (r *ServerRouter) SetupRoutes()

func (*ServerRouter) StartServe

func (r *ServerRouter) StartServe()

func (*ServerRouter) StopServe

func (r *ServerRouter) StopServe()

func (*ServerRouter) String

func (r *ServerRouter) String() string

Jump to

Keyboard shortcuts

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