Documentation
¶
Overview ¶
Package artifact defines the zip artifact format: the tree hash and the deterministic zip writer that makecatalogs and the agent share (see site/src/content/docs/guides/zip-items.md). Keep it free of agent dependencies, like pkg/catalog.
Index ¶
Constants ¶
const ( Darwin = "darwin" Windows = "windows" )
Target OS names. Any other value keeps the files' executable bits, as darwin does; windows records every file as 644.
const TemplateSuffix = ".tmpl"
TemplateSuffix marks a file in a tree as the template of the file of the same name without it, which sofcat renders beside it on the device (zip-items guide, "Tree templates").
Variables ¶
This section is empty.
Functions ¶
func ShippedTemplates ¶
ShippedTemplates is Templates for a tree as an archive ships it, which must not hold both x and x.tmpl: the render would overwrite x. A directory x (files under x/) is refused too: the render could not write x at all. makecatalogs refuses such a tree at pack time and in the repository's zips, and the device refuses it when placing.
func Templates ¶
Templates returns, in order, the templates among paths, a tree's slash-separated file paths. It refuses a file named just .tmpl and an x.tmpl.tmpl, which the render would have nowhere to put. A placed tree holds each template beside its output; see ShippedTemplates for a tree as an archive ships it.
Types ¶
type Packed ¶
type Packed struct {
Hash string `json:"hash"` // lowercase hex sha256 of the zip
TreeHash string `json:"tree_hash"` // "sha256:<hex>"
}
Packed is what Pack reports about the zip it wrote.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a directory read for hashing or packing: its regular files, sorted by slash-separated relative path in byte order.
func Read ¶
Read lists the regular files under dir. goos is the target OS: for Windows every file is recorded as 644, otherwise a file with any executable bit set is 755. Read refuses a tree that holds a symlink or any other non-regular file, and one with no files; empty directories do not count.
func (*Tree) Hash ¶
Hash returns the tree hash, "sha256:" and the lowercase hex sha256 of one record per file: "<path>\x00<755|644>\x00<hex sha256 of content>\n".