freeze

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package freeze provides functions for creating and unpacking frozen filterconfig zip files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFilterConfig

func ExpandFilterConfig(fc map[string]any, rules map[string][]string)

ExpandFilterConfig copies meta-ISIL entries to each target ISIL and removes the original key.

func Fetch

func Fetch(opts FolioOpts, outputPath string) error

Fetch fetches a filterconfig from FOLIO and writes a frozen zip to outputPath.

func FetchOrCached

func FetchOrCached(fopts FolioOpts, copts CacheOpts) (string, error)

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

func ParseExpandRules(s string) (map[string][]string, error)

ParseExpandRules parses an expand string as inline JSON or a file path.

func UnfreezeFilterConfig

func UnfreezeFilterConfig(frozenfile string) (dir, blob string, err error)

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.

Jump to

Keyboard shortcuts

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