barrel_design_manifest (barrel_design v0.1.0)
View SourceDesign manifests: validation, normalization and view signatures.
A design is plain data: a name, a version and named views. A view selects documents with a BQL predicate, builds rows with either a native projection (key and value paths) or a Wasm map, and may total them with _sum, _count or a Wasm reducer run at read time (#{module, export, value}). Keys of the input may be atoms or binaries, so a manifest read from JSON normalizes the same way.
The signature of a view hashes its selector, key and value specs, reducer, map module digest, ABI, export, fields, the limits that bound a map and the key encoding version. Titles, build and the read-time limits do not count, so a caption edit keeps the index and a view stored by an earlier release keeps its signature.
Summary
Functions
Module digests the design's views reference.
Whether a document (with its id) passes a compiled selector.
Compile a stored selector: SELECT * FROM db WHERE ... over one document, with no parameters, ordering, limits, projection or unnest.
SHA-256 of the canonical semantic form of a normalized view.
A normalized design as JSON values: binary keys, texts, numbers, lists; digests as lowercase hex. normalize/1 gives the design back.
The modules one view runs: its map's and its reducer's.
Types
Functions
-spec default_limits() -> map().
Module digests the design's views reference.
Whether a document (with its id) passes a compiled selector.
Compile a stored selector: SELECT * FROM db WHERE ... over one document, with no parameters, ordering, limits, projection or unnest.
SHA-256 of the canonical semantic form of a normalized view.
A normalized design as JSON values: binary keys, texts, numbers, lists; digests as lowercase hex. normalize/1 gives the design back.
The modules one view runs: its map's and its reducer's.