pool

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* TODO need work with a Queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool work pool

func New

func New(minRoutines int, maxRoutines int, timeout time.Duration, logger *logr.Logger) *Pool

New create new pool

func (*Pool) Dispatch

func (p *Pool) Dispatch(task Task) string

Dispatch submit a task

func (*Pool) GetResult

func (p *Pool) GetResult() *[]TaskStatus

GetResult get tasks result of pool

func (*Pool) Shutdown

func (p *Pool) Shutdown()

Shutdown stutdown pool

type Task

type Task interface {
	GetName() string
	Run(workRoutine int) (interface{}, error)
}

Task task interface

type TaskStatus

type TaskStatus struct {
	Name       string
	ID         string
	Err        error
	Data       interface{}
	Executor   string
	AssignTime time.Time
	StartTime  time.Time
	Duration   time.Duration
}

TaskStatus task status

Jump to

Keyboard shortcuts

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