Documentation ¶
Index ¶
- Variables
- func SetupLogger(spec *config.Specification)
- type Controller
- func (c *Controller) ExitPreHook() chan bool
- func (c *Controller) ListStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (c *Controller) StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (c *Controller) StaticFileHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params)
- func (c *Controller) StopStreamHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- type IController
- type StopDTO
- type StreamDTO
- type SummariseDTO
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("Timeout error")
ErrTimeout describes an error related to timing out
var ErrUnexpected = errors.New("Unexpected error")
ErrUnexpected describes an unexpected error
Functions ¶
func SetupLogger ¶
func SetupLogger(spec *config.Specification)
SetupLogger sets the logger for the proper settings based on the environment
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller holds all handler functions for the API
func NewController ¶
func NewController(spec *config.Specification, fileServer http.Handler) *Controller
NewController creates a new instance of Controller
func (*Controller) ExitPreHook ¶
func (c *Controller) ExitPreHook() chan bool
ExitPreHook is a function that can recognise when the application is being closed and cleans up all background running processes
func (*Controller) ListStreamHandler ¶
func (c *Controller) ListStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ListStreamHandler is the HTTP handler of the GET /list call
func (*Controller) StartStreamHandler ¶
func (c *Controller) StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
StartStreamHandler is an HTTP handler for the POST /start endpoint
func (*Controller) StaticFileHandler ¶
func (c *Controller) StaticFileHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params)
StaticFileHandler is HTTP handler for direct file requests
func (*Controller) StopStreamHandler ¶
func (c *Controller) StopStreamHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
StopStreamHandler is the HTTP handler of the stop stream request - POST /stop
type IController ¶
type IController interface { ListStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // handler - GET /list StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // handler - POST /start StaticFileHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // handler - GET /stream/{id}/{file} StopStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // handler - POST /stop ExitPreHook() chan bool // runs before the application exits to clean up // contains filtered or unexported methods }
IController describes main functions for the controller
type StopDTO ¶
type StopDTO struct { ID string `json:"id"` Alias string `json:"alias"` Wait bool `json:"wait"` Remove bool `json:"remove"` }
StopDTO describes a DTO for the /remove and /stop endpoints