md_publish() compiles a spec and writes it as a bundle; md_reference()
reads a published bundle into the form npmatch matches against. This is
PLAN.md section 7b's first tier: most users download a compiled
reference, not the database.
Arguments
- spec
An
md_spec()with alabel.- root
The publish directory. Defaults to
md_data_root()/publish.- con
A connection from
md_db().- set_latest
Point
latest.jsonat this bundle.- label
A published label, e.g.
"active-observed".- spec_hash
The bundle to point the label at.
- build_index
Also build npmatch's blocking index (
npmatch::np_ref_index()), so the result can go straight to the cascade. Needs npmatch, which matchdb only suggests; without it the index is skipped with a message.- fetch
Download the bundle first with
md_fetch_reference():TRUEalways (a bundle already here and intact is not downloaded again),"missing"only when the label is not published locally.
Value
The bundle directory, invisibly.
For md_reference(), a list: reference (an np_reference),
name_freq, token_idf, addr_freq (an np_addr_freq, when published),
places (a list of the place, place_layer and place_unit rows for
the bundle's places, when published), clusters (when published),
ref_index (when built) and stamp.
What a bundle is
<root>/<label>/<spec_hash>/ holds
reference.parquetthe frame
md_compile()returnsname_freq.parquet,token_idf.parquetnpmatch's corpus statistics for exactly that frame
addr_freq.parquetaddress sharing over exactly that frame (
md_addr_freq()): records per address and suite, suite coverage, name concentration and npmatch's place classplace.parquet,place_layer.parquet,place_unit.parquetwhen
md_build_places()has run: the evidence and flags for the places the frame touches, counted over the whole databasereport.jsonthe compile report: shape and absence
stamp.jsonthe spec, the spec hash, the database fingerprint, the normalizer signature, the npmatch and matchdb versions, and the md5 of every file above
and <root>/latest.json maps each label to the bundle currently published
under it.
Why the stamp is checked, and rollback is a pointer
A bundle's derived columns and statistics are only right for the normalizer
that made them (section 9). md_reference() refuses a bundle whose
normalizer signature is not the installed one, and one whose files do not
match their recorded md5. Rolling back is editing latest.json back to an
earlier hash - md_publish_pointer() - since every bundle stays where it was
written (section 7d).