Documentation
¶
Overview ¶
Package mapscatalog fetches the public download catalog from the graywolf-maps Worker (GET <base>/manifest.json) and caches it in-process with a TTL. Stale-on-error: a refresh that fails after the catalog is warm continues serving the previous copy with a warning. A cold failure (no cached copy) returns the error.
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 fetches and caches the worker catalog.
func New ¶
New constructs a Cache. baseURL is the maps host root (e.g. https://maps.nw5w.com). tokenProvider returns the current bearer token (may be empty for public testing). ttl is the cache lifetime; 0 means always refresh.
type Catalog ¶
type Catalog struct {
SchemaVersion int `json:"schemaVersion"`
GeneratedAt string `json:"generatedAt"`
Countries []Country `json:"countries"`
Provinces []Province `json:"provinces"`
States []State `json:"states"`
// contains filtered or unexported fields
}
func (*Catalog) HasSlug ¶
HasSlug reports whether slug names a published archive in this catalog. Slugs are namespaced ("state/colorado", "country/de", "province/ca/british-columbia"). O(1) when the index is populated (every catalog returned by Cache.Get is); falls back to a linear scan for hand-constructed Catalog values where indexSlugs has not run.