listener

package
v0.0.0-...-e8f7e12 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 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 Listener

type Listener interface {
	// Listen defines the method a Listener should implement to notify addition or removal
	// in the list of elements
	// Implementation should always post the whole new list of elements
	Listen(chan []string)
}

Listener defines methods an object must implement to be used as a listener

type Poll

type Poll func() ([]string, error)

Poll defines the interface a function should implement to be a poller

type PollListener

type PollListener struct {
	// Ticker is the channel controlling the polling interval (typically fed by time.NewTicker(1 * time.Second))
	Ticker <-chan time.Time
	// Logger is the logger in which errors and log messages will be printed
	Logger logger.Logger
	// Poll is the function called to get the new state
	Poll Poll
}

PollListener a poller context

func (*PollListener) Listen

func (p *PollListener) Listen(out chan []string)

Listen implements the Listener interface and forwards all chandes to out

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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