Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterMetrics()
- type Client
- type Configuration
- func (c *Configuration) CacheSize(size int64) *Configuration
- func (c *Configuration) HTTPClient(httpClient HTTPRequester) *Configuration
- func (c *Configuration) ItemsToPrune(i uint32) *Configuration
- func (c *Configuration) LogLevel(l int) *Configuration
- func (c *Configuration) RemoteServer(s string) *Configuration
- func (c *Configuration) Server(server string) *Configuration
- func (c *Configuration) VideoPath(videoPath string) *Configuration
- type Fragment
- type HTTPRequester
Constants ¶
View Source
const ( MasterPlaylistName = "master.m3u8" SchemaRemote = "remote://" Dev = iota + 1 Prod )
Variables ¶
View Source
var ( ErrNotOK = errors.New("http response not OK") ErrNotFound = errors.New("fragment not found") ErrChannelNotEnabled = resolve.ErrChannelNotEnabled )
View Source
var ( TranscodedCacheSizeBytes = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "transcoded_cache_size_bytes", }) TranscodedCacheItemsCount = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "transcoded_cache_items_count", }) TranscodedResult = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "transcoded_request_result", }, []string{"type"}) TranscodedCacheQueryCount = prometheus.NewCounter(prometheus.CounterOpts{ Name: "transcoded_cache_query_count", }) TranscodedCacheMiss = prometheus.NewCounter(prometheus.CounterOpts{ Name: "transcoded_cache_miss", }) TranscodedCacheRetry = prometheus.NewCounter(prometheus.CounterOpts{ Name: "transcoded_cache_retry", }) FetchSizeBytes = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "fetch_size_bytes", }, []string{"source"}) FetchDurationSeconds = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "fetch_duration_seconds", }, []string{"source"}) FetchCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "fetch_count", }, []string{"source"}) FetchFailureCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "fetch_failure_count", }, []string{"source", "type"}) )
Functions ¶
func RegisterMetrics ¶
func RegisterMetrics()
Types ¶
type Client ¶
type Client struct { *Configuration // contains filtered or unexported fields }
func New ¶
func New(cfg *Configuration) Client
func (Client) GetPlaybackPath ¶
GetPlaybackPath returns a root HLS playlist path.
func (Client) PlayFragment ¶
func (c Client) PlayFragment(lbryURL, sdHash, fragmentName string, w http.ResponseWriter, r *http.Request) (int64, error)
PlayFragment retrieves requested stream fragment and serves it into the provided HTTP response.
func (Client) RestoreCache ¶
RestoreCache restores cache from disk. LRU data is not restored.
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func Configure ¶
func Configure() *Configuration
func (*Configuration) CacheSize ¶
func (c *Configuration) CacheSize(size int64) *Configuration
CacheSize defines local disk cache size for downloaded transcoded videos.
func (*Configuration) HTTPClient ¶
func (c *Configuration) HTTPClient(httpClient HTTPRequester) *Configuration
func (*Configuration) ItemsToPrune ¶
func (c *Configuration) ItemsToPrune(i uint32) *Configuration
ItemsToPrune defines how many items to prune during cache cleanup
func (*Configuration) LogLevel ¶
func (c *Configuration) LogLevel(l int) *Configuration
LogLevel sets verbosity of logging. `Dev` outputs a lot of debugging info, `Prod` is more restrained.
func (*Configuration) RemoteServer ¶
func (c *Configuration) RemoteServer(s string) *Configuration
RemoteServer is full URL of remote transcoded videos storage server (sans forward slash at the end).
func (*Configuration) Server ¶
func (c *Configuration) Server(server string) *Configuration
Server sets transcoder server API address.
func (*Configuration) VideoPath ¶
func (c *Configuration) VideoPath(videoPath string) *Configuration
VideoPath is where transcoded videos will be downloaded and stored.
Click to show internal directories.
Click to hide internal directories.