background

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Backgrounds = sync.Map{}

Backgrounds 后台任务集合

Functions

func All

func All() map[string]map[string]Background

All 所有任务

func Cancel

func Cancel(op string, cacheKeys ...string)

Cancel 取消执行

Types

type Background

type Background struct {
	Options echo.H
	Started time.Time
	// contains filtered or unexported fields
}

Background 后台执行信息

func New

func New(c context.Context, opt echo.H) *Background

New 新建后台执行信息

func (*Background) Cancel

func (b *Background) Cancel()

Cancel 取消执行

func (*Background) Context

func (b *Background) Context() context.Context

Context 暂存上下文信息

type Group

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

Group 执行信息

func ListBy

func ListBy(op string) *Group

ListBy 获取某个操作的所有任务

func NewGroup

func NewGroup() *Group

func Register

func Register(c echo.Context, op string, cacheKey string, bg *Background) (*Group, error)

func (*Group) Add

func (e *Group) Add(op string, cacheKey string, bgExec *Background)

Add 新增任务

func (*Group) Cancel

func (e *Group) Cancel(cacheKeys ...string)

Cancel 取消某个任务

func (*Group) Exists

func (e *Group) Exists(cacheKey string) bool

Exists 任务是否存在

func (*Group) Map

func (e *Group) Map() map[string]Background

Map 任务列表

Jump to

Keyboard shortcuts

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