Documentation ¶
Index ¶
- Constants
- Variables
- func CORSMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
- func CreateRoutes(r *router.Router, manager *VideoManager, log logging.KVLogger, cb AuthCallback)
- func MetricsMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
- func RegisterMetrics()
- func SetLogger(l *zap.SugaredLogger)
- type AuthCallback
- type Gatekeeper
- type HttpServerConfig
- 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) StartHttpServer(config HttpServerConfig) (chan struct{}, error)
- func (m *VideoManager) Video(uri string) (string, error)
Constants ¶
const ( TokenCtxField = "token" AuthHeader = "Authorization" AuthTokenPrefix = "Bearer " AdminChannelField = "channel" )
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 CORSMiddleware ¶ added in v0.15.0
func CORSMiddleware(h fasthttp.RequestHandler) fasthttp.RequestHandler
func CreateRoutes ¶ added in v0.15.1
func CreateRoutes(r *router.Router, manager *VideoManager, log logging.KVLogger, cb AuthCallback)
CreateRoutes creates a set of HTTP entrypoints that will route requests into video library.
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 AuthCallback ¶ added in v0.15.1
type AuthCallback func(*fasthttp.RequestCtx) bool
type Gatekeeper ¶
Gatekeeper defines a function that checks if supplied queue item and its value should be admitted to the queue.
type HttpServerConfig ¶ added in v0.16.0
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)
func (*VideoManager) StartHttpServer ¶ added in v0.16.0
func (m *VideoManager) StartHttpServer(config HttpServerConfig) (chan struct{}, error)