client

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

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 added in v0.10.11

func RegisterMetrics()

Types

type Client

type Client struct {
	*Configuration
	// contains filtered or unexported fields
}

func New

func New(cfg *Configuration) Client

func (Client) BuildURL added in v0.15.0

func (c Client) BuildURL(loc streamLocation, filename string) string

func (Client) GetPlaybackPath added in v0.9.1

func (c Client) GetPlaybackPath(lbryURL, sdHash string) string

GetPlaybackPath returns a root HLS playlist path.

func (Client) PlayFragment added in v0.9.1

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

func (c Client) RestoreCache() (int64, error)

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 added in v0.5.9

func (c *Configuration) ItemsToPrune(i uint32) *Configuration

ItemsToPrune defines how many items to prune during cache cleanup

func (*Configuration) LogLevel added in v0.6.1

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 added in v0.11.0

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.

type Fragment added in v0.9.1

type Fragment struct {
	// contains filtered or unexported fields
}

func (Fragment) Path added in v0.9.1

func (f Fragment) Path() string

func (Fragment) Size added in v0.9.1

func (f Fragment) Size() int64

type HTTPRequester

type HTTPRequester interface {
	Do(req *http.Request) (res *http.Response, err error)
}

Jump to

Keyboard shortcuts

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