Documentation
¶
Overview ¶
Package freeze provides functions for creating and unpacking frozen filterconfig zip files.
Index ¶
- func ExpandFilterConfig(fc map[string]any, rules map[string][]string)
- func Fetch(opts FolioOpts, outputPath string) error
- func FetchOrCached(fopts FolioOpts, copts CacheOpts) (string, error)
- func ParseExpandRules(s string) (map[string][]string, error)
- func UnfreezeFilterConfig(frozenfile string) (dir, blob string, err error)
- type CacheOpts
- type FolioOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandFilterConfig ¶
ExpandFilterConfig copies meta-ISIL entries to each target ISIL and removes the original key.
func FetchOrCached ¶
FetchOrCached returns the path to a frozen filterconfig zip file. If a valid cached file exists (within TTL and not forced), it returns the cached path. Otherwise it fetches from FOLIO, writes a new zip, and caches it.
func ParseExpandRules ¶
ParseExpandRules parses an expand string as inline JSON or a file path.
func UnfreezeFilterConfig ¶
UnfreezeFilterConfig takes the name of a zipfile (from span-freeze) and returns of the path the thawed filterconfig (along with the temporary directory and error). When this function returns, all URLs in the filterconfig have then been replaced by absolute path on the file system. Cleanup of temporary directory is responsibility of caller.
Types ¶
type CacheOpts ¶
type CacheOpts struct {
TTL time.Duration // how long a cached file is valid
Force bool // force re-download, ignoring cache
Dir string // cache directory (default: XDG cache)
}
CacheOpts configures filterconfig caching.
type FolioOpts ¶
type FolioOpts struct {
OkapiURL string // OKAPI base URL
Tenant string // FOLIO tenant, e.g. "de_15"
Token string // OKAPI auth token
Limit int // API pagination limit
Expand map[string][]string // meta-ISIL expansion rules
NoProxy bool // ignore system proxy settings
}
FolioOpts configures how the filterconfig is fetched from FOLIO.