Documentation ¶
Index ¶
- Variables
- func AttachVideoHandler(r *router.Router, prefix string, manager *VideoManager, log logging.KVLogger)
- func CORSMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
- func MetricsMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
- func RegisterMetrics()
- func SetLogger(l *zap.SugaredLogger)
- type Gatekeeper
- type HttpAPI
- type HttpAPIConfiguration
- func (c *HttpAPIConfiguration) Addr(addr string) *HttpAPIConfiguration
- func (c *HttpAPIConfiguration) Debug(debug bool) *HttpAPIConfiguration
- func (c *HttpAPIConfiguration) VideoManager(mgr *VideoManager) *HttpAPIConfiguration
- func (c *HttpAPIConfiguration) VideoPath(videoPath string) *HttpAPIConfiguration
- type Pool
- type TranscodingRequest
- type VideoLibrary
- type VideoManager
- func (m *VideoManager) Library() *library.Library
- func (m *VideoManager) Pool() *Pool
- func (m *VideoManager) RequestStatus(sdHash string) int
- func (m *VideoManager) Requests() <-chan *TranscodingRequest
- func (m *VideoManager) ResolveStream(uri string) (*TranscodingRequest, error)
- func (m *VideoManager) Video(uri string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( QueueLength = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "transcoding_queue_length", Help: "Video queue length", }, []string{"queue"}) QueueHits = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "transcoding_queue_hits", Help: "Video queue hits", }, []string{"queue"}) QueueItemAge = prometheus.NewSummaryVec(prometheus.SummaryOpts{ Name: "transcoding_queue_item_age_seconds", Help: "Age of queue items before they get processed", }, []string{"queue"}) )
Functions ¶
func AttachVideoHandler ¶ added in v0.15.0
func AttachVideoHandler(r *router.Router, prefix string, manager *VideoManager, log logging.KVLogger)
NewRouter creates a set of HTTP entrypoints that will route requests into video library and video transcoding queue.
func CORSMiddleware ¶ added in v0.15.0
func CORSMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
func MetricsMiddleware ¶ added in v0.15.0
func MetricsMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
func RegisterMetrics ¶
func RegisterMetrics()
func SetLogger ¶
func SetLogger(l *zap.SugaredLogger)
Types ¶
type Gatekeeper ¶
Gatekeeper defines a function that checks if supplied queue item and its value should be admitted to the queue.
type HttpAPI ¶
type HttpAPI struct { *HttpAPIConfiguration // contains filtered or unexported fields }
HttpAPI ties HTTP API together and allows to start/shutdown the web server.
func NewHttpAPI ¶
func NewHttpAPI(cfg *HttpAPIConfiguration) *HttpAPI
type HttpAPIConfiguration ¶
type HttpAPIConfiguration struct {
// contains filtered or unexported fields
}
func ConfigureHttpAPI ¶
func ConfigureHttpAPI() *HttpAPIConfiguration
func (*HttpAPIConfiguration) Addr ¶
func (c *HttpAPIConfiguration) Addr(addr string) *HttpAPIConfiguration
func (*HttpAPIConfiguration) Debug ¶
func (c *HttpAPIConfiguration) Debug(debug bool) *HttpAPIConfiguration
func (*HttpAPIConfiguration) VideoManager ¶
func (c *HttpAPIConfiguration) VideoManager(mgr *VideoManager) *HttpAPIConfiguration
func (*HttpAPIConfiguration) VideoPath ¶
func (c *HttpAPIConfiguration) VideoPath(videoPath string) *HttpAPIConfiguration
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool contains queues which can admit items based on gatekeeper functions.
func (*Pool) AddQueue ¶
func (p *Pool) AddQueue(name string, minHits uint, k Gatekeeper)
AddQueue adds a queue and its gatekeeper function to the pool.
func (*Pool) Admit ¶
Admit retries to put item into the first queue that would accept it. Queues are traversed in the same order they are added. If gatekeeper returns an error, admission stops and the error is returned to the caller.
type TranscodingRequest ¶
type TranscodingRequest struct { resolve.ResolvedStream // contains filtered or unexported fields }
func (*TranscodingRequest) Complete ¶
func (r *TranscodingRequest) Complete()
func (*TranscodingRequest) Reject ¶
func (r *TranscodingRequest) Reject()
func (*TranscodingRequest) Release ¶
func (r *TranscodingRequest) Release()
type VideoLibrary ¶ added in v0.15.0
type VideoManager ¶
type VideoManager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(lib *library.Library, minHits int) *VideoManager
NewManager creates a video library manager with a pool for future transcoding requests.
func (*VideoManager) Library ¶
func (m *VideoManager) Library() *library.Library
func (*VideoManager) Pool ¶
func (m *VideoManager) Pool() *Pool
func (*VideoManager) RequestStatus ¶
func (m *VideoManager) RequestStatus(sdHash string) int
func (*VideoManager) Requests ¶
func (m *VideoManager) Requests() <-chan *TranscodingRequest
Requests returns next transcoding request to be processed. It polls all queues in the pool evenly.
func (*VideoManager) ResolveStream ¶ added in v0.15.0
func (m *VideoManager) ResolveStream(uri string) (*TranscodingRequest, error)