cancel

package
v6.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 4 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 struct {
	context.Context
	Cancel context.CancelFunc
}

Canceller is a simple wrapper for a cancellable context which makes the associated context.CancelFunc more easily accessible.

func New

func New(ctx context.Context) *Canceller

New returns a new canceller with the parent context.

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 (*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