tracker
All repositories: gitoria
1.8 KB
// lib/export.hl — READING THE OLD TRACKER'S MONGO EXPORT (/media/STORAGE/projects/old-tracker/mongo-export/*.jsonl, EJSON, one// document per line): the lines of a file, a Mongo id, the chunk workaround for big files. Used by the one-off tools// tools/migrate.hl (tracker.worldapi.org#2) and tools/old-short-ids.hl (mission 060). Mission 028: was copied into both.import { run } from 'hl:proc'import { readFile, mkDir, exists } from 'hl:fs'static nl = ""static linesOf = (&path) => {raw = readFile(path)if (raw == null) { return [] }out = []for (l of raw.split(nl)) { if (l != '') { out.push(l) } }return out}static oidOf = (&v) => {if (v == null) { return null }if (hlTypeName(v) == 'String') { return v }return v['$oid']}// hl:fs readFile SILENTLY TRUNCATES at 10 MiB (fs.zig hl_fs_read_file, max_size = 1024*1024*10,// no error, no flag — reported as a Hybriel gap, tracker.worldapi.org#2): Show.jsonl (12.4 MB),// Season.jsonl (10.9 MB) and Episode.jsonl (140 MB) are all over it. Worked around WITHOUT// touching the vendored plugin: `split` (coreutils, via hl:proc run — no shell, no JS) cuts the// export into <10 MB chunks in a scratch dir first; each chunk is read whole (well under the cap).static padNum4 = (&n) => {let s = '' + nwhile (s.length < 4) { s = '0' + s }return s}static bigLinesOf = (&path, &chunkDir, &perChunk) => {mkDir(chunkDir, 448)r = run(['split', '-l', '' + perChunk, '-d', '-a', '4', '--additional-suffix=.jsonl', path, chunkDir + '/c_'])if (r == null || r.exit != 0) { hlError('split failed for ' + path) }out = []let idx = 0while (true) {fp = chunkDir + '/c_' + padNum4(&idx) + '.jsonl'if (!exists(fp)) { break }for (l of linesOf(&fp)) { out.push(l) }idx = idx + 1}if (idx == 0) { hlError('no chunks produced for ' + path) }return out}
Branches
Latest commits
- 17feb7abHM55 WIP: hm54-fill re-applied on main; browser gate fails at ep3 toggleTracker
- 28eab08cMerge branch 'records-hm55' into mainTracker
- d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
- 3059f86cMerge branch 'records-design-rule' into mainTracker
- 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
- d1390692Merge branch 'records-dp75b' into mainTracker
- a4d1a7d2|||PR records: later steps checked, branch auditTracker
- e070e16fMerge branch 'records-dp75' into mainTracker
- 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
- bfc4ea4dMerge branch 'ap62' into mainTracker
- 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker
- b9c7c3c8Merge branch 'records-dp74' into mainTracker
- 85cfb4ae|||PR records: AP61 day61, DP74 liveTracker
- b1496147Merge branch 'ap61' into mainTracker
- 2047955bMerge branch 'u12-gateports' into mainTracker
- c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Tracker
- 4e018678|||PR deploy.sh: gates use Tracker's ports 8716-8719 and LC_ALL=C; README: 2 backups keptTracker
- 0b86324aMerge branch 'records-dp73' into mainTracker
- 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker
- 613ae0ecMerge branch 'bs3' into mainTracker