index

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStop = errors.New("iteration stopped")
)

Functions

This section is empty.

Types

type File

type File struct {
	Path string `json:"path"`
	Hash string `json:"hash"`
	Size uint64 `json:"size"`
}

type Index

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

func New

func New(path string) *Index

func (*Index) Beat

func (st *Index) Beat(id string)

func (*Index) Check

func (st *Index) Check() error

func (*Index) Close

func (st *Index) Close() error

func (*Index) Get

func (st *Index) Get(status Status, n int) ([]*Video, error)

func (*Index) Init

func (st *Index) Init() error

func (*Index) Iter

func (st *Index) Iter(status Status, f func(*Video) error) error

func (*Index) Pop

func (st *Index) Pop(n int) ([]*Video, error)

func (*Index) Push

func (st *Index) Push(ids []string) (int, error)

func (*Index) Put

func (st *Index) Put(videos ...*Video) error

func (*Index) PutByID

func (st *Index) PutByID(force bool, ids ...string) error

func (*Index) Retry

func (st *Index) Retry(id string, mode RetryMode) error

type Meta

type Meta struct {
	Title        string    `json:"title,omitempty"`
	Description  string    `json:"description,omitempty"`
	ChannelID    string    `json:"channel_id,omitempty"`
	ChannelTitle string    `json:"channel_title,omitempty"`
	Tags         []string  `json:"tags,omitempty"`
	PublishedAt  time.Time `json:"published_at,omitempty"`
}

type RetryMode

type RetryMode uint8
const (
	RetryInfinite RetryMode = 1 + iota
	RetryLimited
)

type Status

type Status string
const (
	StatusNew        Status = "NEW"
	StatusEnqueued   Status = "ENQUEUED"
	StatusSkipped    Status = "SKIPPED"
	StatusInProgress Status = "INPROGRESS"
	StatusDone       Status = "DONE"
	StatusFailed     Status = "FAILED"
	StatusAny        Status = ""
)

type Storage

type Storage struct {
	ID string `json:"id"`
}

type Video

type Video struct {
	ID         string     `json:"id"`
	Status     Status     `json:"status"`
	Storages   []Storage  `json:"storages,omitempty"`
	Files      []File     `json:"file,omitempty"`
	Deadline   *time.Time `json:"deadline,omitempty"`
	Attempt    int        `json:"attempt,omitempty"`
	RetryAfter *time.Time `json:"retry_after,omitempty"`
	Meta       *Meta      `json:"meta,omitempty"`
	Reason     string     `json:"reason,omitempty"`
}

func (*Video) ClearSystem

func (v *Video) ClearSystem()

func (*Video) Key

func (v *Video) Key() []byte

func (*Video) Row

func (v *Video) Row(full bool) string

func (*Video) StatusKey

func (v *Video) StatusKey() []byte

Jump to

Keyboard shortcuts

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