cancel

package
v0.0.0-...-3c2809b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0, 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