Documentation
¶
Overview ¶
Package taskcontrol carries process-local controls scoped to one task execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.