Documentation ¶
Index ¶
- Variables
- func BatchHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
- func CreateBatchHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
- func DecrCounter(addr *uint64)
- func IncrCounter(addr *uint64)
- func InitializeServer(sc *core.ServerConfiguration, listen string, port string)
- func InitializeStatusServer(listen string, port string)
- func NewImageHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
- func NewRouter(sc *core.ServerConfiguration) *mux.Router
- func ResizeHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
- func ResizeManyHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
- type ServerStatus
- type Stats
- type Status
Constants ¶
This section is empty.
Variables ¶
var ShuttingDown bool
ShuttingDown variable is used to note that the server is about to shut down. It is false by default, and set to true when a shutdown signal is received.
Functions ¶
func BatchHandler ¶
func BatchHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
func CreateBatchHandler ¶
func CreateBatchHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
func InitializeServer ¶
func InitializeServer(sc *core.ServerConfiguration, listen string, port string)
InitializeServer creates a new http server to handle image processing requests
func InitializeStatusServer ¶
InitializeStatusServer starts a web server that can be used to monitor the health of the application. It returns a response with status code 200 if the system is healthy.
func NewImageHandler ¶
func NewImageHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
NewImageHandler handles posting new images
func NewRouter ¶
func NewRouter(sc *core.ServerConfiguration) *mux.Router
NewRouter creates a mux.Router for use in code or in tests
func ResizeHandler ¶
func ResizeHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
ResizeHandler asumes the original image is either stores locally or on the remote server it returns the processed image in given dimension and format. When an image is requested more than once, only one will do the processing, and both requests will return the same output
func ResizeManyHandler ¶
func ResizeManyHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)
ResizeManyHandler asumes the original image is either stores locally or on the remote server It returns status code 200 and no content A listing will be requested to the uploader to determine what images are missing, and only Images not already processed will be generated and uploaded
Types ¶
type ServerStatus ¶
type ServerStatus struct{}
ServerStatus implements the http.Handler interface
func (*ServerStatus) ServeHTTP ¶
func (f *ServerStatus) ServeHTTP(w http.ResponseWriter, req *http.Request)
It returns a status code 501 when the server is shutting down, or when a processor is not detected. Details are provided in the body of the request.