Documentation
¶
Overview ¶
Package trackmap provides a small mutex-guarded map for the CI trackers.
Each platform tracker keeps the same three lookups — the CI unit's current state, its display handle, and its spinner — keyed by whatever identifies a unit on that platform: a job or check ID for GitLab and GitHub, a status-context name for Forgejo. The bookkeeping around those maps was written out three times, once per platform, differing only in the key and value types.
Only that bookkeeping lives here. How a job transitions from pending to running, and what its label should read, stay in each platform's tracker: GitLab jobs, GitHub checks and Forgejo commit statuses genuinely differ, and folding them together would trade a small saving for an abstraction that hides real behaviour.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map is a map guarded by a read-write mutex, safe for concurrent use.
Each method locks for its own call only. Callers that read a value, decide something from it, and write it back are not doing so atomically — that matches how the trackers have always behaved, since a spinner refresh runs concurrently with the poll loop and both merely observe the latest state.
func (*Map[K, V]) Delete ¶
func (t *Map[K, V]) Delete(key K)
Delete removes key. Deleting an absent key is a no-op.
func (*Map[K, V]) Keys ¶
func (t *Map[K, V]) Keys() []K
Keys returns the keys currently present, in unspecified order.
The slice is a snapshot: callers can iterate it while other goroutines mutate the map, which is what the trackers need when comparing the previous poll's units against the current one.