cancel

package
v0.0.0-...-12d8225 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: AGPL-3.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelableDownload

func CancelableDownload(c *HTTPRequestCanceller, do func(req *http.Request) (*http.Response, error), req *http.Request) (*http.Response, chan bool, error)

CancelableDownload performs an http request and allows for it to be canceled at any time.

Types

type Canceller

type Canceller interface {
	context.Context
	Cancel()
}

Canceller extends context.Context with a built-in Cancel function.

func New

func New() Canceller

New returns a new Canceller.

type HTTPRequestCanceller

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

HTTPRequestCanceller tracks a cancelable operation.

func NewHTTPRequestCanceller

func NewHTTPRequestCanceller() *HTTPRequestCanceller

NewHTTPRequestCanceller returns a new HTTPRequestCanceller struct.

func NewHTTPRequestCancellerWithContext

func NewHTTPRequestCancellerWithContext(ctx context.Context) *HTTPRequestCanceller

NewHTTPRequestCancellerWithContext returns a new HTTPRequestCanceller that automatically cancels when the given context is cancelled.

func (*HTTPRequestCanceller) Cancel

func (c *HTTPRequestCanceller) Cancel() error

Cancel will attempt to cancel all ongoing operations.

func (*HTTPRequestCanceller) Cancelable

func (c *HTTPRequestCanceller) Cancelable() bool

Cancelable indicates whether there are operations that support cancellation.

Jump to

Keyboard shortcuts

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