trackmap

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 New

func New[K comparable, V any]() *Map[K, V]

New returns an empty Map ready for use.

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]) Get

func (t *Map[K, V]) Get(key K) (V, bool)

Get returns the value stored for key, and whether it was present.

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.

func (*Map[K, V]) Len

func (t *Map[K, V]) Len() int

Len reports how many entries the map holds.

func (*Map[K, V]) Set

func (t *Map[K, V]) Set(key K, value V)

Set stores value under key, replacing any previous entry.

Jump to

Keyboard shortcuts

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