Documentation
¶
Index ¶
- Variables
- func FurloughVideos(lib *Library, maxSize uint64) (uint64, uint64, error)
- func LoadEnabledChannels(channels []string)
- func NewSweeper() *sweeper
- func RetireVideos(lib *Library, maxSize uint64) (uint64, uint64, error)
- func SetLogger(l *zap.SugaredLogger)
- func SpawnLibraryCleaning(lib *Library) chan<- bool
- func SpawnPopularSweeper(lib *Library, q *queue.Queue, opts PopularSweeperOpts) chan<- bool
- func SpawnProcessing(q *queue.Queue, lib *Library, p *queue.Poller)
- func SpawnS3Uploader(lib *Library) dispatcher.Dispatcher
- func StringToSize(s string) uint64
- func ValidateByClaim(c *claim.Claim) error
- func ValidateIncomingVideo(uri string) (*claim.Claim, error)
- type AddParams
- type Config
- type DBTX
- type Library
- func (q Library) Add(params AddParams) (*Video, error)
- func (q Library) Furlough(v *Video) error
- func (q Library) Get(sdHash string) (*Video, error)
- func (q Library) IncViews(uri, sdHash string)
- func (q Library) ListLocal() ([]*Video, error)
- func (q Library) ListLocalOnly() ([]*Video, error)
- func (q Library) ListRemoteOnly() ([]*Video, error)
- func (q Library) Retire(v *Video) error
- func (q Library) UpdateRemotePath(sdHash, url string) error
- type PopularSweeperOpts
- type Queries
- func (q *Queries) Add(ctx context.Context, arg AddParams) (*Video, error)
- func (q *Queries) Delete(ctx context.Context, sdHash string) error
- func (q *Queries) Get(ctx context.Context, sdHash string) (*Video, error)
- func (q *Queries) ListLocal(ctx context.Context) ([]*Video, error)
- func (q *Queries) ListLocalOnly(ctx context.Context) ([]*Video, error)
- func (q *Queries) ListRemoteOnly(ctx context.Context) ([]*Video, error)
- func (q *Queries) UpdatePath(ctx context.Context, sdHash, path string) error
- func (q *Queries) UpdateRemotePath(ctx context.Context, sdHash, url string) error
- type S3Uploader
- type TallyItem
- type Video
Constants ¶
This section is empty.
Variables ¶
var ( ErrTranscodingUnderway = errors.New("transcoding in progress") ErrChannelNotEnabled = errors.New("transcoding was not enabled for this channel") ErrNoSigningChannel = errors.New("no signing channel for stream") )
var InitialMigration = `` /* 561-byte string literal not displayed */
Functions ¶
func FurloughVideos ¶ added in v0.5.0
FurloughVideos deletes older videos locally, leaving them only on S3, keeping total size of local videos at maxSize.
func LoadEnabledChannels ¶
func LoadEnabledChannels(channels []string)
func NewSweeper ¶ added in v0.5.0
func NewSweeper() *sweeper
func RetireVideos ¶ added in v0.5.0
RetireVideos deletes older videos from S3, keeping total size of remote videos at maxSize.
func SetLogger ¶
func SetLogger(l *zap.SugaredLogger)
func SpawnLibraryCleaning ¶ added in v0.5.0
func SpawnPopularSweeper ¶ added in v0.5.0
func SpawnPopularSweeper(lib *Library, q *queue.Queue, opts PopularSweeperOpts) chan<- bool
SpawnPopularSweeper will tally up the count of rejected videos and pick top N of them to be added to the queue. For it to work, `lib.IncViews(url, sdHash)` should be called somewhere for every video that is requested but rejected.
func SpawnS3Uploader ¶ added in v0.5.0
func SpawnS3Uploader(lib *Library) dispatcher.Dispatcher
func StringToSize ¶ added in v0.5.0
func ValidateByClaim ¶
Types ¶
type Config ¶ added in v0.5.0
type Config struct {
// contains filtered or unexported fields
}
func (*Config) LocalStorage ¶ added in v0.5.0
func (c *Config) LocalStorage(s storage.LocalDriver) *Config
LocalStorage ...
func (*Config) MaxLocalSize ¶ added in v0.5.0
MaxLocalSize ...
func (*Config) MaxRemoteSize ¶ added in v0.5.0
MaxRemoteSize ...
func (*Config) RemoteStorage ¶ added in v0.5.0
func (c *Config) RemoteStorage(s storage.RemoteDriver) *Config
RemoteStorage ...
type DBTX ¶
type DBTX interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row BeginTx(context.Context, *sql.TxOptions) (*sql.Tx, error) }
type Library ¶
type Library struct { *Config // contains filtered or unexported fields }
Library contains methods for accessing videos database.
func NewLibrary ¶
func (Library) ListLocalOnly ¶ added in v0.5.0
func (Library) ListRemoteOnly ¶ added in v0.5.0
func (Library) UpdateRemotePath ¶ added in v0.5.0
type PopularSweeperOpts ¶ added in v0.5.0
type PopularSweeperOpts struct { // TopNumber limits the number of top viewed videos that will be added to queue every time. TopNumber int // LowerBound sets a lower limit for video views number to be considered. LowerBound int // Interval is the interval at which sweeping routine will be run. Interval time.Duration }
PopularSweeperOpts sets additional options for SpawnPopularSweeper routine.
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ListLocalOnly ¶ added in v0.5.0
func (*Queries) ListRemoteOnly ¶ added in v0.5.0
func (*Queries) UpdatePath ¶ added in v0.5.0
type S3Uploader ¶ added in v0.5.0
type S3Uploader struct {
// contains filtered or unexported fields
}
func (S3Uploader) Do ¶ added in v0.5.0
func (u S3Uploader) Do(t dispatcher.Task) error
type Video ¶
type Video struct { SDHash string CreatedAt string URL string Path string RemotePath string Type string Channel string LastAccessed sql.NullTime AccessCount int64 Size int64 Checksum string }
func (Video) GetLocation ¶ added in v0.5.0
GetLocation returns a video location suitable for using in HTTP redirect response. Bool in return value signifies if it's a remote location (S3) or local (relative HTTP path).