Documentation
¶
Overview ¶
Package stackdir is a stack version's own directory, handed to a workspace exec as a read-only tree: `WITH cwd = "$TXCO_STACK_DIR"` starts the command in it and sets TXCO_STACK_DIR to its path, so an op can run a program kept beside it by path instead of pasting it into stdin.
When one of a stack's ops names $TXCO_STACK_DIR, `txco apply` packs the stack's directory into one canonical tar (the bundle) and uploads it to the hash-addressed file store (filecas). The stack version then carries one fingerprint-only row:
STACKDIR/<sha256 of the tar>.tar content "", content_hash = that sha256
so an unchanged tree costs each new version one small row and its bytes are stored once. A run reads the row from the opstack snapshot it pinned, so an activation never changes the tree a running or resumed run sees.
This file is the leaf layer: the reserved-path vocabulary, the caps and the bundle codec, with no dependency on stores, so the CLI, the admin API, the processor and the workspace providers can import it cheaply.
Index ¶
Constants ¶
const ( // Dir is the reserved top-level directory for the tree's row. Dir = "STACKDIR" // Ext is the row's extension: the bundle is a tar. Ext = ".tar" // Env is the variable a command finds the tree by. Env = "TXCO_STACK_DIR" // Token is how an op names the tree in `cwd`; `txco apply` packs a // stack's tree only when one of its ops contains it. Token = "$" + Env // MaxFileBytes caps one file, as `&include` caps an included one. MaxFileBytes = 1 << 20 // MaxTreeBytes caps the files of one tree, together. MaxTreeBytes = 32 << 20 // MaxFiles caps how many files one tree holds. MaxFiles = 10000 )
Variables ¶
This section is empty.
Functions ¶
func DigestFromPath ¶
DigestFromPath returns the digest a well-formed STACKDIR/ path names, or "".
func Pack ¶
Pack writes the canonical bundle of files: sorted by path, regular files only, every header fixed (mode 0444 or 0555, owner 0, no names, mtime 0), no directory entries. It returns the bytes and their sha256. It refuses what Unpack would refuse, so a bundle that packs also unpacks.
func Path ¶
Path is the stack_files path of the tree whose bundle hashes to digest (sha256, lowercase hex).
func Unpack ¶
Unpack reads a bundle and hands each file to fn, in the bundle's order. It checks every header against the caps and the path rules before fn sees it, and refuses anything but a regular file.
func ValidDigest ¶
ValidDigest reports whether d is a sha256 in lowercase hex.