Documentation
¶
Overview ¶
package poll implements a basic polling mechanism for Kwil event listeners
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPoller ¶
func NewPoller(interval time.Duration, constructor PollFuncConstructor) listeners.ListenFunc
NewPoller creates a new event listener that polls for events. It takes a poll interval and a constructor function that constructs the poll function. The constructor will be called exactly once when the listener starts, while the poll function will be called every interval.
Types ¶
type PollFunc ¶
type PollFunc func(ctx context.Context, service *common.Service, eventstore listeners.EventStore) (stopPolling bool, err error)
PollFunc is a function that is called every interval to poll for events.
type PollFuncConstructor ¶
type PollFuncConstructor func(ctx context.Context, service *common.Service, eventstore listeners.EventStore) (PollFunc, error)
PollFuncConstructor is a function that constructs a PollFunc. If it returns an error, the node will shut down.
Click to show internal directories.
Click to hide internal directories.