server

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 InitializeAdminServer added in v1.18.0

func InitializeAdminServer(listen string, port string)

InitializeAdminServer starts a web server that can be used to monitor the health of the application. It returns a response with data code 200 if the system is healthy.

func InitializeServer

func InitializeServer(sc *core.ServerConfiguration, listen string, port string)

InitializeServer creates a new http server to handle image processing requests

func NewFileHandler added in v1.16.0

func NewFileHandler(w http.ResponseWriter, req *http.Request, sc *core.ServerConfiguration)

NewFileHandler handles posting new files

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 AdminData added in v1.18.0

type AdminData struct {
	Message string `json:"message"`
}

AdminData keeps the current state of the server

type AdminHandler added in v1.18.0

type AdminHandler struct{}

AdminHandler implements the http.Handler interface

func (*AdminHandler) ServeHTTP added in v1.18.0

func (f *AdminHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

It returns a data code 501 when the server is shutting down, or when a processor is not detected. Details are provided in the body of the request.

type NewFileResponse added in v1.16.0

type NewFileResponse struct {
}

Jump to

Keyboard shortcuts

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