workerpool

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry tracks workers by heartbeat lease.

func New

func New(ttl time.Duration) *Registry

func (*Registry) EvictExpired

func (r *Registry) EvictExpired(now time.Time) []Worker

func (*Registry) Heartbeat

func (r *Registry) Heartbeat(id string) bool

func (*Registry) Register

func (r *Registry) Register(id, addr string)

func (*Registry) SetState

func (r *Registry) SetState(id string, state WorkerState) bool

func (*Registry) Snapshot

func (r *Registry) Snapshot() []Worker

type Worker

type Worker struct {
	ID          string
	Addr        string
	State       WorkerState
	LastSeen    time.Time
	LeaseExpire time.Time
}

Worker is an in-memory lease entry for one runtime worker.

type WorkerState

type WorkerState string

WorkerState captures current scheduler view for one worker.

const (
	WorkerIdle    WorkerState = "idle"
	WorkerBusy    WorkerState = "busy"
	WorkerUnknown WorkerState = "unknown"
)

Jump to

Keyboard shortcuts

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