workset

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option[T comparable] func(*WorkSet[T])

func WithLogger

func WithLogger[T comparable](logger *zap.SugaredLogger) Option[T]

WithLogger sets the logger

func WithTaskInterval

func WithTaskInterval[T comparable](d time.Duration) Option[T]

WithTaskInterval sets the task interval

func WithWorkers

func WithWorkers[T comparable](i int) Option[T]

WithWorkers sets the workers

type ProcessFunc

type ProcessFunc[T comparable] func(ctx context.Context, key T) error

ProcessFunc handles one AgentDeploy per invocation.

type WorkSet

type WorkSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewWorkSet

func NewWorkSet[T comparable](name string, processFunc ProcessFunc[T], opts ...Option[T]) *WorkSet[T]

func (*WorkSet[T]) Contains

func (w *WorkSet[T]) Contains(key T) bool

Contains reports whether the key is in the set.

func (*WorkSet[T]) Forget

func (w *WorkSet[T]) Forget(key T)

Forget removes a key from the set.

func (*WorkSet[T]) Len

func (w *WorkSet[T]) Len() int

Len is the size of the set.

func (*WorkSet[T]) Snapshot

func (w *WorkSet[T]) Snapshot() []T

Snapshot returns a copy of the current keys for a component to iterate without holding the lock or racing concurrent Track/Forget.

func (*WorkSet[T]) Start

func (w *WorkSet[T]) Start(ctx context.Context) error

Start runs the worker pool and the assigner loop until ctx is cancelled.

func (*WorkSet[T]) Track

func (w *WorkSet[T]) Track(key T)

Track adds a key to the set (idempotent)..

Jump to

Keyboard shortcuts

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