Parse, validate, build and render SWHIDs (Software Hash Identifiers, ISO 18670).
A SWHID is represented as a plain map:
{:type :content :hash "<40 hex>"
:qualifiers {...}} ; :qualifiers present only when non-empty
pr prints it as the tagged literal #swh/id "swh:1:...", which reads
it back (see data_readers.clj).
This namespace covers manipulation of SWHIDs (parse / validate / render / compare). Hash computation from local artifacts lives in swhid.hash.
Both the JVM and Babashka are supported, with no dependency.
Parse, validate, build and render SWHIDs (Software Hash Identifiers, ISO 18670).
A SWHID is represented as a plain map:
{:type :content :hash "<40 hex>"
:qualifiers {...}} ; :qualifiers present only when non-empty
`pr` prints it as the tagged literal #swh/id "swh:1:...", which reads
it back (see data_readers.clj).
This namespace covers *manipulation* of SWHIDs (parse / validate / render /
compare). Hash computation from local artifacts lives in swhid.hash.
Both the JVM and Babashka are supported, with no dependency.(core-swhid swhid)Return the SWHID with its qualifiers removed (the bare core identifier).
Return the SWHID with its qualifiers removed (the bare core identifier).
(make type hash)(make type hash qualifiers)Build a SWHID map from an object type keyword, a 40-hex object id, and an optional qualifiers map. Validates its arguments, and throws on qualifiers that cannot be valid on this type (lines on a directory, …).
Build a SWHID map from an object type keyword, a 40-hex object id, and an optional qualifiers map. Validates its arguments, and throws on qualifiers that cannot be valid on this type (lines on a directory, …).
(parse s)Parse a SWHID string into a SWHID map. Throws ex-info if invalid. Qualifiers that the spec says to ignore (lines on a directory, visit without origin, …) are left out.
Parse a SWHID string into a SWHID map. Throws ex-info if invalid. Qualifiers that the spec says to ignore (lines on a directory, visit without origin, …) are left out.
(swhid->string {:keys [type hash qualifiers]})Render a SWHID map to its canonical string form, leaving out the
qualifiers the spec says to ignore (visit without origin, …). Trusts
:hash and :qualifiers: build hand-made maps with make, which
validates them.
Render a SWHID map to its canonical string form, leaving out the qualifiers the spec says to ignore (visit without origin, …). Trusts :hash and :qualifiers: build hand-made maps with `make`, which validates them.
(valid? s)Return true if s is a syntactically valid SWHID string.
Return true if `s` is a syntactically valid SWHID string.
(with-anchor swhid anchor)anchor is a SWHID map or core SWHID string.
`anchor` is a SWHID map or core SWHID string.
(with-qualifier swhid k v)Return swhid with qualifier k set to v. Validates the result.
Return `swhid` with qualifier `k` set to `v`. Validates the result.
(with-visit swhid snp)snp is a snapshot SWHID map or core SWHID string.
`snp` is a snapshot SWHID map or core SWHID string.
(without-qualifier swhid k)Return swhid with qualifier k removed.
Return `swhid` with qualifier `k` removed.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |