taskutils

package
v2.4.7 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithHandler added in v2.3.0

func ContextWithHandler(ctx context.Context, handler *PbHandler) context.Context

ContextWithHandler return a ctx contains handler

func NewHandler added in v2.3.0

func NewHandler(c context.Context) (*PbHandler, ClearFunc)

NewHandler new a PbHandler to handle progress bar, and a cancelFunc to cancel the handler

Types

type AtServiceTask

type AtServiceTask struct {
	navvy.Task
	types.Pool
	types.Fault

	types.Service
}

AtServiceTask is the root task for service only task.

func NewAtServiceTask

func NewAtServiceTask(poolSize int) *AtServiceTask

NewAtServiceTask will create a new between storage task.

type AtStorageTask

type AtStorageTask struct {
	navvy.Task
	types.Pool
	types.Fault

	types.Path
	types.Storage
	types.Type
}

AtStorageTask is the root task for single storage task.

func NewAtStorageTask

func NewAtStorageTask(poolSize int) *AtStorageTask

NewAtStorageTask will create a new between storage task.

type BetweenStorageTask

BetweenStorageTask is the root task for tasks operate between two storager.

func NewBetweenStorageTask

func NewBetweenStorageTask(poolSize int) *BetweenStorageTask

NewBetweenStorageTask will create a new between storage task.

type ClearFunc added in v2.3.0

type ClearFunc func()

ClearFunc is the alias of func to clear PbHandler

type PbHandler added in v2.3.0

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

PbHandler is used to handle progress bar

func HandlerFromContext added in v2.3.0

func HandlerFromContext(ctx context.Context) *PbHandler

HandlerFromContext get handler from ctx, if not exist, return nil

func (*PbHandler) StartProgress added in v2.3.0

func (h *PbHandler) StartProgress(d time.Duration)

StartProgress start to get state from state center. d is the duration time between two data, Start a ticker to get data from noah periodically. The data from noah is a map with taskID as key and its state as value. So we range the data and update relevant bar's progress.

func (*PbHandler) WaitProgress added in v2.3.0

func (h *PbHandler) WaitProgress()

WaitProgress wait the progress bar to complete

Jump to

Keyboard shortcuts

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