taskcontrol

package
v0.10.0-alpha.20 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package taskcontrol carries process-local controls scoped to one task execution.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("taskcontrol: timeout controller closed")

ErrClosed reports that the task execution no longer accepts timeout requests.

Functions

This section is empty.

Types

type TimeoutController

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

TimeoutController carries timeout requests for one execution.

func FromContext

func FromContext(ctx context.Context) *TimeoutController

FromContext returns the timeout controller attached to ctx.

func WithTimeoutController

func WithTimeoutController(ctx context.Context) (context.Context, *TimeoutController)

WithTimeoutController attaches a new execution-scoped timeout controller.

func (*TimeoutController) Close

func (c *TimeoutController) Close()

Close rejects pending and future timeout requests.

func (*TimeoutController) Done

func (c *TimeoutController) Done() <-chan struct{}

Done closes when the bound execution no longer accepts timeout requests.

func (*TimeoutController) RequestTimeout

func (c *TimeoutController) RequestTimeout(ctx context.Context, reason string) error

RequestTimeout synchronously requests deterministic timeout failure.

func (*TimeoutController) Requests

func (c *TimeoutController) Requests() <-chan TimeoutRequest

Requests returns timeout requests awaiting execution acknowledgement.

type TimeoutRequest

type TimeoutRequest struct {
	Reason string
	// contains filtered or unexported fields
}

TimeoutRequest asks the bound execution to fail with Reason.

func (TimeoutRequest) Complete

func (r TimeoutRequest) Complete(err error)

Complete acknowledges that the bound execution accepted the request.

Jump to

Keyboard shortcuts

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