poller

package
v0.0.0-...-2e8e066 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Poller

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

Poller executes a polling function on an interval.

func New

func New(source Source, interval, timeout time.Duration) *Poller

New returns a new poller for the given source. A ticker with the provided polling interval will be started immediately, but an invocation of the polling function will not run until its interval has elapsed. If immediate invocation is desired the Poll function should be called immediately after the poller has been created.

func (*Poller) Close

func (p *Poller) Close()

Close causes the poller to stop polling and release any resources consumed by the poller. It will implicitly call the close function on the polling source.

func (*Poller) Poll

func (p *Poller) Poll()

Poll causes the poller to immediately poll the polling source. It does not wait for the polling action to complete.

type Source

type Source interface {
	Poll(ctx context.Context)
	Close() // TODO: Consider removing this and doing a runtime type check for io.Closer
}

Source is a polling source.

Jump to

Keyboard shortcuts

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