poll

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

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