Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

world_vcs.derive.snapshot

A read-only view of an asset as a stage holds it, and the one fingerprint rule shared with preview.inputsFingerprint.

  • of(assetPath, staged, opts?) builds a DeriveSnapshot from staged entries shaped like the status staged rows, { path, staged_action?, staged_checksum, blob_sha256?, deps? }, laid over opts.base, the files of the asset in the tree the stage's commit lands on ({ path, checksum_sha256, blob_sha256?, refs_json? }, the dependencies read from refs_json); a delete row removes a file, and opts.exclude names relative paths left out, such as the output a hook computes. An entry another entry lies beneath, staged or in the base, is a folder (a folder asset nested in the asset, such as a material's textures/basecolor.texture) and is left out: the asset holds the files beneath it (foldersOf(paths) names them). A base file with no blob address is read as text through its content address. files maps each file's path relative to the asset to its content address; read(rel) fetches the staged blob on first use, decodes it and keeps it on the snapshot, and answers nil for an absent file or an unreadable blob.
  • opts.placed (from placedFiles) names files of the asset an install places where the world holds no row of its own, each with its content address, VFS path and references: one joins of at a path no base or staged entry holds, is read from the working tree, and counts toward the version a pin of a folder asset nested in the asset states, so an installed asset the world edited fingerprints whole, the way the live asset does.
  • placedFiles(path, isPlaced, opts?) lists the live files of the asset that isPlaced says an install places.
  • laidOver(base, stages) lays the staged entries of each commit, oldest first, over the base rows and answers the tree in the base shape; a staged delete removes the path.
  • live(path, opts?) builds the same shape over the live files of the asset, with each file's dependencies from asset.deps.
  • fingerprintLines(s) returns the lines a fingerprint hashes: f <relative path> <address> per file in path order, each followed by d <guid> <checksum> per asset the file references.
  • EXCLUDED names the files that are never inputs: preview.png, README.md and .metadata.
local snapshot = require("modules.world_vcs.derive.snapshot")
local s = snapshot.live("/zero/source/a.material")
print(__crypto.sha256_hex(table.concat(snapshot.fingerprintLines(s), "\n")))