Documentation
¶
Overview ¶
Package registry is the single source of truth for the cacheable Jira metadata resources: their identity, default freshness window, and fetch. It is deliberately free of cobra command wiring so any consumer — the cache command group, `jira boards list`, `jira issue link types`, the refresh-all runner — can depend on the resource metadata without pulling in the command builders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry = []Resource{ {Name: "labels", Short: "Cache and print the global Jira label list", TTLMinutes: ttlHour, Fetch: fetchLabelsForCache}, {Name: "projects", Short: "Cache and print the visible Jira project list", TTLMinutes: 7 * ttlDay, Fetch: fetchProjectsForCache}, {Name: "epics", Short: "Cache and print the visible epic list", TTLMinutes: 4 * ttlHour, Fetch: fetchEpicsForCache}, {Name: "fields", Short: "Cache and print the visible Jira field list", TTLMinutes: 14 * ttlDay, Fetch: fetchFieldsForCache}, {Name: "issuetypes", Short: "Cache and print the visible Jira issue-type list", TTLMinutes: 30 * ttlDay, Fetch: fetchIssueTypesForCache}, {Name: "linktypes", Short: "Cache and print the configured issue-link types", EnvelopeKey: "link_types", TTLMinutes: 90 * ttlDay, Fetch: fetchLinkTypesForCache}, {Name: "boards", Short: "Cache and print the visible Jira agile boards", TTLMinutes: 28 * ttlDay, Fetch: nil}, {Name: "statuses", Short: "Cache and print the visible Jira status list", TTLMinutes: 30 * ttlDay, Fetch: fetchStatusesForCache}, {Name: "priorities", Short: "Cache and print the visible Jira priority list", TTLMinutes: 90 * ttlDay, Fetch: fetchPrioritiesForCache}, {Name: "resolutions", Short: "Cache and print the configured Jira resolution list", TTLMinutes: 90 * ttlDay, Fetch: fetchResolutionsForCache}, }
Registry is the canonical, ordered list of cacheable resources — the order the subcommands are registered on the `cache` group. `cache clear`, the primer factory, and the refresh-all runner all derive from it, so a new resource is one entry here rather than scattered edits.
The per-resource TTL ladder runs long because no consumer blocks on staleness and a re-fetch is one --refresh away, so the only cost of a long TTL is a brand-new value staying invisible to autocomplete until the next refresh. User-generated resources (labels, epics) stay short; admin/config resources (statuses, priorities, link types, …) run weeks-to-months. The schema-version check (cache.SchemaVersion) handles shape changes separately, so age never risks a mis-parse. boards has a nil Fetch: its bespoke command carries truncation + per-board project metadata the generic factory cannot express.
Functions ¶
func ResourceNames ¶
func ResourceNames() []string
ResourceNames returns the resource names in registry order.
func TTLMinutesFor ¶
TTLMinutesFor returns the default freshness window in minutes for a resource. An unknown name falls back to 60 minutes — the historical default — so a lookup miss degrades to today's behavior rather than a zero TTL.
Types ¶
type Resource ¶
type Resource struct {
// Name identifies the resource — subcommand, cache file, and op label.
Name string
// Short is the cobra one-line command summary.
Short string
// EnvelopeKey is the envelope data key the resource list is emitted
// under. Empty means "same as Name".
EnvelopeKey string
// TTLMinutes is the default --ttl-minutes for the resource's primer.
TTLMinutes int
// Fetch retrieves the resource from Jira and returns the JSON list to
// cache. A nil Fetch marks a resource with a bespoke command (boards),
// which the generic primer factory skips.
Fetch func(ctx context.Context, client *jira.Client) (json.RawMessage, error)
}
Resource describes one cacheable Jira metadata resource. The Name is used three ways that must stay in lock-step: the `cache <name>` subcommand, the on-disk cache file name, and the `cache.<name>` operation label. EnvelopeKey is the data key the list is emitted under — usually Name, but linktypes emits "link_types".