Expand description
Script names and the IRIs built from them.
A script is named by one segment, urn:script:{name}, and everything about it hangs
below that name: …:version:{digest}, …:compiled, …:result, …:runs and
…:run:{id}. The name is a segment of the IRI rather than an argument so that a
capability can bind to it (urn:cap:script:run:{name}), which is the same reason
ikigai-ledger names its ledgers.
use ikigai_script::name;
assert_eq!(name::script_iri("nightly"), "urn:script:nightly");
assert_eq!(
name::version_iri("nightly", "sha256:ab"),
"urn:script:nightly:version:sha256:ab"
);
assert_eq!(name::run_iri("nightly", 7), "urn:script:nightly:run:7");
assert!(name::validate("nightly-report_2").is_ok());
assert!(name::validate("Nightly").is_err()); // lowercase only
assert!(name::validate("a:b").is_err()); // one segment
assert!(name::validate("eval").is_err()); // reserved: `urn:script:eval` is the paste boxConstants§
- CATALOG_
IRI - The catalog: what is registered, its state, head version and last run.
- EVAL_
IRI - The ad hoc door: run supplied code under the caller’s own authority.
- MAX_
NAME - The longest name.
- PREFIX
- Every script IRI starts here.
- RESERVED
- Names a script may not take, because a resource already answers there or because the name means something to the capability grammar.
Functions§
- authority_
thread - The golden thread a host cuts when it changes the ceiling it allows
{name}(<config home>/script-authority/{name}):urn:script:{name}:authority. - part_
iri urn:script:{name}:{part}:compiled,resultorruns.- run_iri
urn:script:{name}:run:{id}: one recorded run.- script_
iri urn:script:{name}: the script itself (the head).- validate
- Check a script name:
[a-z0-9][a-z0-9_-]*, at mostMAX_NAMEbytes, notRESERVED. - version_
iri urn:script:{name}:version:{digest}: one immutable version.