task

package
v0.0.0-...-bf0d46e Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Task)

func WithConcurrency

func WithConcurrency(c int) Option

type Singleton

type Singleton[E storage.Entry] interface {
	Tasker[E]

	// Do need to be implemented
	Do(E) ([]E, bool)

	// PostBatchDo need to be implemented
	PostBatchDo([]E)
}

type Task

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

func (*Task) AddState

func (t *Task) AddState(s string) int

AddState int 当前行行数 从 1 开始

func (*Task) Concurrency

func (t *Task) Concurrency() int

func (*Task) HasBeenInit

func (t *Task) HasBeenInit() bool

func (*Task) Init

func (t *Task) Init(opts ...Option)

func (*Task) Log

func (t *Task) Log() []string

func (*Task) Logf

func (t *Task) Logf(format string, a ...any)

func (*Task) Logln

func (t *Task) Logln(a ...any)

func (*Task) Output

func (t *Task) Output() []string

func (*Task) Printf

func (t *Task) Printf(format string, a ...any)

func (*Task) Println

func (t *Task) Println(a ...any)

func (*Task) SetState

func (t *Task) SetState(line int, s string)

func (*Task) State

func (t *Task) State() []string

type Tasker

type Tasker[E storage.Entry] interface {
	// Title need to be implemented
	Title() string

	// Prepare need to be implemented
	Prepare() error

	// PreDo need to be implemented
	PreDo() error

	// PostDo need to be implemented
	PostDo() error

	// Close need to be implemented
	Close() error

	// Blink need to be implemented
	Blink()

	Init(...Option)
	HasBeenInit() bool
	Concurrency() int
	State() []string
	Output() []string
}

type Work

type Work[E storage.Entry] interface {
	Tasker[E]

	// Do need to be implemented
	// effected
	Do([]E) int
}

Jump to

Keyboard shortcuts

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