Documentation
¶
Overview ¶
Package fetch downloads and verifies sources and adds them to the store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckValid ¶
CheckValid asks f's store about the store paths of all pinned requests in one batched validity query. With a store that remembers valid paths (store.WithValidityMemo), the following Ensure of an input that is valid already then runs no Nix command (A312). It only saves work: requests without a pinned hash are left to Ensure, and an error changes nothing Ensure would do.
Types ¶
type Fetcher ¶
type Fetcher interface {
// Ensure makes the store path valid and returns it: already valid, then substituters
// (nix-store --realise of the path), then origin URLs. It never runs a Nix FOD.
Ensure(ctx context.Context, r Request) (storePath string, err error)
// Resolve downloads without a known NarHash (bob lock) and returns the hashes to record.
Resolve(ctx context.Context, r Request) (hash, narHash string, err error)
}
Fetcher gets every external input.
type Policy ¶
type Policy struct {
DenyPrivate bool // refuse private, loopback and link-local addresses
}
Policy is the egress policy set by the caller (developers: no restriction).
type Request ¶
type Request struct {
URLs []string // mirrors in order
Kind Kind // File (flat) or Archive (unpacked tree)
Hash string // SRI of the downloaded bytes (required for File; checked if set for Archive)
NarHash string // SRI of the unpacked tree (required for Archive)
Name string // store name
Strip int // leading path components to drop (Archive)
MaxBytes int64 // 0 = 2 GiB
Label string // for error messages
}
Request is one external input (SPEC R-NIX-014).