freezecmd

package
v0.2.37 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package freezecmd implements the core of span-freeze: it packages a file containing URLs along with the content of all those URLs into a zip file.

It supports two modes. Legacy mode reads a blob from an io.Reader, extracts URLs, downloads them, and packages everything into a zip. FOLIO mode fetches metadata collections from the FOLIO API, builds a span-tag compatible filter configuration, downloads referenced files, and packages them the same way.

Output zip structure:

/blob          original input or generated filterconfig JSON
/mapping.json  URL to local path mapping
/files/<sha1>  downloaded content

Index

Constants

View Source
const (
	NameBlob    = "blob"
	NameMapping = "mapping.json"
	NameDir     = "files"
)

Variables

This section is empty.

Functions

func RunFolio

func RunFolio(cfg FolioConfig, outputPath string) error

RunFolio delegates to the freeze package for FOLIO-based filterconfig generation, writing the resulting zip to outputPath.

func RunLegacy

func RunLegacy(cfg LegacyConfig, client HTTPGetter, r io.Reader, w io.Writer) error

RunLegacy reads a blob from r, extracts and downloads all URLs found in it, and writes them into a zip (written to w) alongside the original blob.

Types

type FolioConfig

type FolioConfig struct {
	OkapiURL string
	Tenant   string
	Token    string
	Limit    int
	Expand   string
	NoProxy  bool
}

FolioConfig holds the tunables for the FOLIO freeze mode.

func DefaultFolioConfig

func DefaultFolioConfig() FolioConfig

DefaultFolioConfig returns the default FOLIO configuration.

type HTTPGetter

type HTTPGetter interface {
	Get(url string) (*http.Response, error)
}

HTTPGetter is the subset of *http.Client used to download resources. It can be stubbed in tests.

type LegacyConfig

type LegacyConfig struct {
	BestEffort bool
	Expand     string // JSON or file mapping meta-ISILs to lists of ISILs
}

LegacyConfig holds the tunables for the legacy (stdin) freeze mode.

Jump to

Keyboard shortcuts

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