poll

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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