optracker

package
v1.43.9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCanceled = errors.New("operation canceled")

Functions

This section is empty.

Types

type AsyncBuildJobs added in v1.16.1

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

func NewAsyncBuildJobs added in v1.16.1

func NewAsyncBuildJobs(ctx context.Context, appID string, tracker *OpTracker) *AsyncBuildJobs

func (*AsyncBuildJobs) Go added in v1.16.1

func (a *AsyncBuildJobs) Go(description string, track bool, minDuration time.Duration, f func(ctx context.Context) error)

func (*AsyncBuildJobs) Tracker added in v1.16.1

func (a *AsyncBuildJobs) Tracker() *OpTracker

func (*AsyncBuildJobs) Wait added in v1.16.1

func (a *AsyncBuildJobs) Wait() error

type OpTracker

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

func New

func New(w io.Writer, stream OutputStream) *OpTracker

func (*OpTracker) Add

func (t *OpTracker) Add(msg string, minStart time.Time) OperationID

Add creates a new item on the operations tracker returning the ID for that op. minStart is the time at which the tracker will start to show the task as in progress.

This function is safe to call on a Nil OpTracker and will no-op in that case

func (*OpTracker) AllDone

func (t *OpTracker) AllDone()

AllDone marks all ops as done. This function is safe to call on a Nil OpTracker.

func (*OpTracker) Cancel added in v1.4.0

func (t *OpTracker) Cancel(id OperationID)

Cancel marks the operation as canceled. It is equivalent to t.Fail(id, ErrCanceled).

func (*OpTracker) Done

func (t *OpTracker) Done(id OperationID, minDuration time.Duration)

Done marks the given operation as done

This function is safe to call on a Nil OpTracker and will no-op in that case

func (*OpTracker) Fail

func (t *OpTracker) Fail(id OperationID, err error)

Fail marks the operation as failed with the given error

This function is safe to call on a Nil OpTracker and will no-op in that case

type OperationID

type OperationID int
const NoOperationID OperationID = -1

type OutputStream added in v1.11.0

type OutputStream interface {
	Send(*daemonpb.CommandMessage) error
}

Jump to

Keyboard shortcuts

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