worker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Count = runtime.NumCPU()

Functions

This section is empty.

Types

type Action

type Action[T any] func(task *Task[T]) error

type Bytes added in v0.3.0

type Bytes struct {
	Tracker Tracker[BytesTask]

	Tasks []*Task[BytesTask]

	LogPath string
}

func (*Bytes) Download added in v0.3.0

func (b *Bytes) Download(dir string) error

type BytesBarTracker added in v0.3.0

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

func (*BytesBarTracker) Add added in v0.3.0

func (t *BytesBarTracker) Add(task *Task[BytesTask])

func (*BytesBarTracker) Render added in v0.3.0

func (t *BytesBarTracker) Render(_ int) func()

type BytesTask added in v0.3.0

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

func (*BytesTask) Read added in v0.3.0

func (bt *BytesTask) Read(p []byte) (int, error)

func (*BytesTask) Write added in v0.3.0

func (bt *BytesTask) Write(data []byte) (int, error)

type BytesTracker added in v0.3.0

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

func (*BytesTracker) Add added in v0.3.0

func (t *BytesTracker) Add(task *Task[BytesTask])

func (*BytesTracker) Render added in v0.3.0

func (t *BytesTracker) Render(_ int) func()

type Task

type Task[T any] struct {
	Name  string
	Value *T

	Action Action[T]
	// contains filtered or unexported fields
}

func DownloadTask added in v0.3.0

func DownloadTask(name string, reader io.ReadCloser, total uint64) *Task[BytesTask]

type Tracker added in v0.3.0

type Tracker[T any] interface {
	Render(total int) func()

	Add(task *Task[T])
}

func NewBytesBarTracker added in v0.3.0

func NewBytesBarTracker(tasks []*Task[BytesTask]) Tracker[BytesTask]

func NewBytesTracker added in v0.3.0

func NewBytesTracker(tasks []*Task[BytesTask]) Tracker[BytesTask]

func NewJobTracker added in v0.3.0

func NewJobTracker[T any](verb string) Tracker[T]

type Worker

type Worker[T any] struct {
	Name string

	Tasks   []*Task[T]
	Tracker Tracker[T]

	LogPath string
}

func (*Worker[T]) Run

func (w *Worker[T]) Run(action Action[T]) error

Jump to

Keyboard shortcuts

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