Documentation
¶
Overview ¶
Package workercache maintains an in-memory view of all workers, kept current via store.Interface.WatchWorkers. It exposes Workers() for fast O(1) reads during actor scheduling and is the natural home for future indices (by node, by label, etc.) as scheduling requirements grow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache maintains an in-memory snapshot of all workers.
TODO: add metrics — at minimum a gauge for worker count, a counter for resync events, and a counter for failed worker-watch notifications.
func New ¶
New creates a Cache backed by a given store. relistInterval controls how often the cache performs a full ListWorkers to recover from state drifts caused by missing WorkerWatch events.
func (*Cache) Forget ¶
Forget removes a worker that a store write proved no longer exists. The normal delete watch remains authoritative, but this closes the short race in which scheduling selected a worker just after its row was deleted and before the watch event reached the cache.
func (*Cache) Start ¶
Start syncs the cache synchronously, then spawns a background goroutine that streams updates, relists periodically, and resyncs on connection loss. Returns as soon as the initial sync succeeds.