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) {let 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
- 833aee2flog: #50 closed, HM56 startedmre
- ac58c1e5mission: HM56mre
- 58979c0clog: HM54 held for decision, DP65 startedmre
- bb2ebc67log: #64 live, #53 mergedmre
- 27cde42fMerge hm53-dom: tracker#53 inputs bound to membersmre
- 2156cc7flog: HM54 reviewmre
- 9fb82efclog: HM54 gap, fill continuesmre
- b632eb8dlog: HM53 done, HM54 startedmre
- ccb1a263tracker#53: bind editor drafts and use key event focus targetmre
- 3356fcfclog: #52 blocked, HM53 startedmre
- 833dcfc9Merge hm52-search: report only, tracker#52 blocked by framework gapmre
- 73010cc0HM52: report replace-navigation search draft regressionmre
- 1742e92bstatus: DP64 and HM52 runningmre
- 29ad5b58log: #64 merged, DP64 and HM52 startedmre
- fafddbf9Merge hm64-catalog: tracker#64 catalog from packed entriesmre
- b2e2206dlog: #63 livemre
- 5831e0e0log: HM64 donemre
- 4042b923Flatten catalog membership rows into paired slotsmre
- ea8a759elog: #61 #62 live, DP63 and HM64 startedmre
- 40439456Merge hm63-searchtext: tracker#63 packed search textmre