Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FinishedResult = &commandResult{}
FinishedResult is a sentinel can be returned by a PollerFunc to signal polling should exit
Functions ¶
This section is empty.
Types ¶
type Poller ¶
type Poller struct { Channel chan interface{} Poll PollerFunc WaitInterval time.Duration // contains filtered or unexported fields }
Poller represents everything needed for polling a function
func NewPoller ¶
func NewPoller(poll PollerFunc, interval time.Duration) *Poller
NewPoller creates a new poller for a function with a polling interval NOTE: the polling function cannot return `nil`
func (*Poller) IsFinished ¶
IsFinished returns whether or not the polling worker has completed
func (*Poller) IsStopped ¶
IsStopped returns whether or not the polling worker has been stopped or is finished perhaps should be refactored to IsClosed, or IsRunnable
func (*Poller) Start ¶
func (p *Poller) Start()
Start starts the polling process -- cannot be restarted after stopping
func (*Poller) Stop ¶
func (p *Poller) Stop()
Stop exits the polling loop on the next attempt, waits for it to finish, and closes the channel
func (*Poller) StopAndBlock ¶
func (p *Poller) StopAndBlock()
StopAndBlock stops the poller and blocks until it is closed
type PollerManager ¶
type PollerManager interface { AddPoller(pollerType, name string, poller *Poller) GetPoller(pollerType, name string) *Poller HasPoller(pollerType, name string) bool RemovePoller(pollerType, name string) bool PollerIsRunning(pollerType, name string) bool }
func NewManager ¶
func NewManager() PollerManager