Versions in this module Expand all Collapse all v0 v0.0.1 Jun 7, 2024 Changes in this version + const DefaultTick + const ErrQueueCanceled + const ErrQueueNoAvailableItem + const ErrQueueRestart + const ErrQueueTimeout + const ErrValueDisappeared + var AcquireTTL = 1 * time.Second + var ManagedTTL = 30 * time.Second + var UnmanagedTTL = 10 * time.Minute + func ErrQueueEntryTimedOut(key Key) error + func ErrQueueNoAvailableItems(key Key) error + func ErrQueueValueDisappeared(key Key) error + type Detail struct + Bot string + ID int64 + Pack int64 + func (d Detail) Clone() Detail + type Error string + func (e Error) Error() string + type Items map[domain.AnimeBase]*State + type Key any + type KeyError struct + Key Key + func (e *KeyError) Error() string + func (e *KeyError) Is(target error) bool + func (e *KeyError) Unwrap() (err error) + type Mapper interface + Map func(active, inactive Items) (V, error) + type Progress struct + CurrentDuration *float64 + CurrentFilesize *float64 + Duration *float64 + Filesize *float64 + Percentage float64 + Speed float64 + Type string + func (p Progress) Equal(other Progress) bool + type Queue struct + func NewCustomQueue(tick time.Duration) *Queue + func NewQueue() *Queue + func (q *Queue) ActiveItems() Items + func (q *Queue) AddLimit(limit int) + func (q *Queue) Cancel(anime domain.AnimeBase) + func (q *Queue) Close() (err error) + func (q *Queue) Collector() prometheus.Collector + func (q *Queue) Contains(anime domain.AnimeBase) (found bool) + func (q *Queue) Delete(anime domain.AnimeBase) + func (q *Queue) ErrC() <-chan error + func (q *Queue) Get(anime domain.AnimeBase) (value *State, ok bool) + func (q *Queue) GetLimit() int + func (q *Queue) InactiveItems() Items + func (q *Queue) IsActive(anime domain.AnimeBase) (isActive bool) + func (q *Queue) IsBusy() bool + func (q *Queue) L(ctx context.Context) *zap.Logger + func (q *Queue) Len() int64 + func (q *Queue) Notifier() <-chan struct{} + func (q *Queue) Pause() + func (q *Queue) Paused() bool + func (q *Queue) Pop() (anime domain.AnimeBase, state *State, ok bool) + func (q *Queue) PushBack(anime domain.AnimeBase, state *State) (pushed bool) + func (q *Queue) PushFront(anime domain.AnimeBase, state *State) (pushed bool) + func (q *Queue) Restart(anime domain.AnimeBase) + func (q *Queue) Resume() + func (q *Queue) Update(anime domain.AnimeBase, state *State) + func (q *Queue) UpdateProgress(anime domain.AnimeBase, progress Progress) + func (q *Queue) UpdateUnmanaged(cb func(Key, *State) bool) + type StartedFrom int + const StartedFrom_AutoDownload + const StartedFrom_Web + func (s StartedFrom) String() string + type State struct + Details []Detail + Progress Progress + StartedFrom StartedFrom + func (v *State) Active() bool + func (v *State) Cancel() + func (v *State) Clone() (value *State) + func (v *State) Close() (err error) + func (v *State) Current() (*Detail, bool) + func (v *State) Done(err error) + func (v *State) Init() + func (v *State) IsUnmanaged() bool + func (v *State) OnUpdate() + func (v *State) Restart() + func (v *State) TimedOut(from time.Time) bool + func (v *State) ToggleUnmanaged() + func (v *State) UpdateProgress(progress Progress) + func (v *State) UpdatedAt() time.Time