Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BoZMwU = SPgxfiXs()
Functions ¶
Types ¶
type ExecutionMode ¶
type ExecutionMode int
ExecutionMode defines whether tasks should run in parallel or sequentially.
const ( Parallel ExecutionMode = 0 Sequential ExecutionMode = 1 )
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task represents an individual task.
type TaskBuilder ¶
type TaskBuilder struct {
// contains filtered or unexported fields
}
TaskBuilder allows building and executing tasks in a chainable manner.
func NewTaskBuilder ¶
func NewTaskBuilder(mode ExecutionMode, workerCount int) *TaskBuilder
NewTaskBuilder creates a new TaskBuilder with the specified execution mode.
func (*TaskBuilder) Add ¶
func (tb *TaskBuilder) Add(fn TaskFunc) *TaskBuilder
Add adds a new TaskFunc to the builder.
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
TaskManager manages and executes tasks concurrently or sequentially.
func NewTaskManager ¶
func NewTaskManager(mode ExecutionMode, workerCount int) *TaskManager
NewTaskManager creates a new TaskManager with the specified execution mode and optional worker count.
func (*TaskManager) AddTask ¶
func (tm *TaskManager) AddTask(task *Task)
AddTask adds a task to the manager.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages a fixed number of workers to process tasks concurrently.
func NewWorkerPool ¶
func NewWorkerPool(workerCount int) *WorkerPool
NewWorkerPool initializes a worker pool with the specified number of workers.
func (*WorkerPool) Results ¶
func (wp *WorkerPool) Results() <-chan result
Results returns the result channel to collect task outputs and errors.
func (*WorkerPool) Run ¶
func (wp *WorkerPool) Run(ctx context.Context, taskIndexes map[*Task]int)
Run starts the workers in the pool.
func (*WorkerPool) Stop ¶
func (wp *WorkerPool) Stop()
Stop closes the task channel and waits for all workers to finish.
func (*WorkerPool) Submit ¶
func (wp *WorkerPool) Submit(task *Task)
Submit adds a task to the task channel.