Skip to main content

Module name

Module name 

Source
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 box

Constants§

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, result or runs.
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 most MAX_NAME bytes, not RESERVED.
version_iri
urn:script:{name}:version:{digest}: one immutable version.