poller

package
v3.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package poller provides the core Poller struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AddressManager dax.AddressManager
	NodeService    dax.NodeService
	NodePoller     NodePoller
	PollInterval   time.Duration
	Logger         logger.Logger
}

type HTTPNodePoller

type HTTPNodePoller struct {
	// contains filtered or unexported fields
}

HTTPNodePoller is an http implementation of the NodePoller interface.

func NewHTTPNodePoller

func NewHTTPNodePoller(logger logger.Logger) *HTTPNodePoller

func (*HTTPNodePoller) Poll

func (p *HTTPNodePoller) Poll(addr dax.Address) bool

type NodePoller

type NodePoller interface {
	Poll(dax.Address) bool
}

NodePoller is an interface to anything which has the ability to poll a node.

type NopNodePoller

type NopNodePoller struct{}

NopNodePoller is a no-op implementation of the NodePoller interface.

func NewNopNodePoller

func NewNopNodePoller() *NopNodePoller

func (*NopNodePoller) Poll

func (p *NopNodePoller) Poll(addr dax.Address) bool

type Poller

type Poller struct {
	// contains filtered or unexported fields
}

Poller maintains a list of nodes to poll. It also polls them.

func New

func New(cfg Config) *Poller

New returns a new instance of Poller with default values.

func (*Poller) Addresses

func (p *Poller) Addresses() []dax.Address

func (*Poller) Run

func (p *Poller) Run() error

Run starts the polling goroutine.

func (*Poller) Stop

func (p *Poller) Stop()

Stop stops the polling routine.

Jump to

Keyboard shortcuts

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