watch

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WatchFormat_Json     = "json"
	WatchFormat_Stringer = "stringer"
	WatchFormat_Gofmt    = "gofmt"

	WatchType_Sync   = "sync"
	WatchType_Atomic = "atomic"
	WatchType_Func   = "func"
	WatchType_Push   = "push"
	WatchType_Static = "static"
)
View Source
const MaxWatchValSize = 128 * 1024
View Source
const MaxWatchVals = 10000
View Source
const MaxWatchWaitTime = 10 * time.Millisecond

Variables

This section is empty.

Functions

func Init added in v0.8.1

func Init(cfg *config.WatchConfig) error

func ValidatePollAtomic added in v0.5.0

func ValidatePollAtomic(val any) error

ValidatePollAtomic validates that the provided value is suitable for use as an atomic poll value. A valid atomic poll value must: - Be non-nil - Be a pointer - Point to a valid atomic type (sync/atomic package types or primitive types that support atomic operations)

func ValidatePollFunc added in v0.5.0

func ValidatePollFunc(fn any) error

ValidatePollFunc validates that the provided function is suitable for use as a poll function. A valid poll function must: - Be non-nil - Be a function - Take 0 arguments - Return exactly 1 value

func ValidatePollSync added in v0.5.0

func ValidatePollSync(lock sync.Locker, val any) error

ValidatePollSync validates that the provided lock and value are suitable for use in a sync-based watch. A valid sync poll setup must have: - A non-nil sync.Locker - A non-nil value - The value must be a pointer

Types

type WatchCollector

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

WatchCollector implements the collector.Collector interface for watch collection

func GetInstance

func GetInstance() *WatchCollector

GetInstance returns the singleton instance of WatchCollector

func (*WatchCollector) AddRegError added in v0.5.0

func (wc *WatchCollector) AddRegError(err ds.ErrWithContext)

func (*WatchCollector) CollectWatches

func (wc *WatchCollector) CollectWatches()

CollectWatches collects watch information and sends it to the controller note we do not hold the lock for the duration of this function

func (*WatchCollector) CollectorName

func (wc *WatchCollector) CollectorName() string

CollectorName returns the unique name of the collector

func (*WatchCollector) Disable

func (wc *WatchCollector) Disable()

Disable stops the collector

func (*WatchCollector) Enable

func (wc *WatchCollector) Enable()

Enable is called when the collector should start collecting data

func (*WatchCollector) GetRegErrors added in v0.5.0

func (wc *WatchCollector) GetRegErrors() []ds.ErrWithContext

GetRegErrors returns a copy of the registration errors

func (*WatchCollector) GetStatus added in v0.5.16

func (wc *WatchCollector) GetStatus() ds.CollectorStatus

GetStatus returns the current status of the watch collector

func (*WatchCollector) GetWatchNames

func (wc *WatchCollector) GetWatchNames() []string

func (*WatchCollector) OnNewConnection added in v0.8.1

func (wc *WatchCollector) OnNewConnection()

OnNewConnection is called when a new connection is established

func (*WatchCollector) PushWatchSample added in v0.5.0

func (wc *WatchCollector) PushWatchSample(name string, val any)

func (*WatchCollector) RegisterWatchDecl added in v0.5.0

func (wc *WatchCollector) RegisterWatchDecl(decl *ds.WatchDecl)

RegisterWatchDecl registers a watch declaration in the watchDecls map Returns an error if a watch with the same name already exists

func (*WatchCollector) SetNextSendFull added in v0.5.0

func (wc *WatchCollector) SetNextSendFull(full bool)

SetNextSendFull sets the nextSendFull flag to force a full update on the next dump

func (*WatchCollector) UnregisterWatch

func (wc *WatchCollector) UnregisterWatch(decl *ds.WatchDecl)

Jump to

Keyboard shortcuts

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