Skip to content

nqdchk(3)

nqdchk, nqdrepn, nqdrepi, nqdrepj, nqdrepfree — check a capsule's data record against its files

libnqd, -lnqd -lnoqtis

#include <nqd.h>

int
nqdchk(const char *dir, nqdrep **rep);

size_t
nqdrepn(const nqdrep *r);

int
nqdrepi(const nqdrep *r, size_t i, const char **check, int *ok, const char **detail);

const char *
nqdrepj(const nqdrep *r, size_t i);

void
nqdrepfree(nqdrep *r);

() reads noqtis.data.json in dir (noqtis-data(5)) and checks the folder against it, one report row per check:

‘record’
the record reads, is of the format and canonical (the detail says what is wrong when not)
‘source’
one per source: its file is there, with the recorded SHA-256 (compared in constant time) and size
‘lock’
one per lock file of env: its file is there, with the recorded SHA-256
‘schema, ‘rule’’
one per schema: its file matches the columns, types, missing-value codes, ranges and sets; one per rule
‘stats’
one per summary: made again from its file, read as the element says (delim, header), else as the file's schema says, the summaries are the recorded ones byte for byte (a calibration, cal, aside); the detail names the first column that differs
‘step’
one per step with both script and sha256: the script or mapping is in the folder with that SHA-256
‘chunk’
per chunks element: its file, whole, has the recorded size and chunk digests (nqdpiece(3))
‘recorded’
one per recorded check: it fails when the check was recorded as ‘fail’. When expected and observed are both numbers it is recomputed: ‘|observed - expected| <= tol’ (tol 0 when not given); when both are strings, they must be equal. A check recorded as ‘pass’ that does not hold fails; the detail gives the numbers

A row about a file marked synthetic says ‘[synthetic]’ after the path. It checks nothing of the seal: check the capsule with nqchk(3) too.

(), () and () read and free the report as nqrep(3) does a capsule's. () returns the numbers of row i as canonical JSON, for rows that have them (those of nqddrift(3)), or NULL. The strings stay valid until the report is freed.

nqdchk() returns NQOK when every row passed and NQEVRFY when one failed (no record, or one that does not read, is a failed ‘record’ row); in both cases *rep is set. NQEARG and NQEMEM return no report. nqdrepi() returns NQEARG for a row that is not there.

noqtis-data(1), nqchk(3), nqdnew(3), noqtis-data(5)