Skip to main content

Crate tatara_lisp_source

Crate tatara_lisp_source 

Source
Expand description

tatara-lisp-source — resolve a Nix-flake-style URL into bytes.

Implements theory/WASM-PACKAGING.md §II: a tatara-script user can pass any of the following as the script path argument, and the resolver fetches the bytes + computes a BLAKE3 content hash for caching:

./local/path.tlisp
github:owner/repo/path/to/program.tlisp
github:owner/repo/path/to/program.tlisp?ref=v0.1.0
github:owner/repo/path/to/program.tlisp?ref=abc123
gitlab:owner/repo/path.tlisp?ref=main
codeberg:owner/repo/path.tlisp
https://example.com/program.tlisp#blake3=abc123…

The wasm-operator (cluster-side) and tatara-script (host-side) use this crate identically — same code, different deployment.

§Caching

Every fetch returns a Resolved with the bytes and a BLAKE3 hash. Callers store the bytes keyed by the hash; subsequent resolves of the same URL find the cache by hash and skip the network.

When a URL has #blake3=<hash> (per Nix’s content-pin convention), the resolver verifies the fetched bytes match before returning.

Structs§

FileCache
File-system-backed cache — used by tatara-script host-side.
MemoryCache
In-memory cache — useful for one-off scripts and tests.
Resolved
Result of resolving a Source — the raw bytes plus the BLAKE3 hash.
Resolver
The resolver — composes a Cache with the host-side fetcher.

Enums§

ResolveError
Source
Typed source — every variant carries everything needed to fetch.

Traits§

Cache
Cache contract. Keys are stable per-URL strings (see crate::Source::cache_key).

Functions§

blake3_hex
Helper for callers that already have bytes and want a hash.
resolve_once
Helper for callers without their own Cache — resolves once, returns the bytes + hash, no caching.