Download src/db/batch-loop-ghost-record.js from VanyaJ/bada-terminal: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/VanyaJ/bada-terminal/resolve/main/src/db/batch-loop-ghost-record.js
- Command line
-
hf download hf://VanyaJ/bada-terminal/src/db/batch-loop-ghost-record.js
-
curl -L -o batch-loop-ghost-record.js https://huggingface.co/VanyaJ/bada-terminal/resolve/main/src/db/batch-loop-ghost-record.js
1.48 kB
| // 승인 grant에 원본이 보존된 마지막 유령 행 하나만 현재 writer transaction에서 제외할 수 있다. | |
| // 설명 문서: docs/specs/batch-loop-ghost.md v1.1.0, docs/specs/batch-loop-first.md v1.0.0 | |
| const{hash}=require('../services/bong-browser-resolution'),{same}=require('./batch-recovery-record'),ghost=require('../services/batch-loop-ghost'); | |
| function verifyRemoval(db,runId,grantId,verify){ | |
| const c=db.getBatchCheckpoint(runId),g=Object.values(c?.recoveries||{}).at(-1),d=g?.loopState,row=db.getBatchRun(runId),{usage:_,...raw}=row||{}; | |
| const first=require('../services/batch-loop-first'); | |
| if(!c||c.revocations||!g||g.id!==grantId||c.revision!==g.checkpointRevision+1||!['unstarted_iteration','unstarted_first_iteration'].includes(d?.reconciliation?.kind)||!same(raw,{...g.originalRun,status:'paused',error_message:null,completed_at:null})||typeof verify!=='function')ghost.fail(); | |
| const actual={run:db.getLoopRun(d.originalRun.run_id),iterations:db.getLoopIterations(d.originalRun.run_id)},event=first.source(c,d);require('../services/batch-recovery-proof').prefixes({checkpoint:c,usage:db.getRuntimeUsage(runId)});if(first.isFirst(d))first.validate(c,g);else ghost.validate(d.reconciliation,event); | |
| if(hash(actual)!==d.rowsHash||actual.iterations.at(-1)?.id!==d.reconciliation.ghostId||hash(actual.iterations.at(-1))!==d.reconciliation.ghostHash||verify(g)!==true)ghost.fail(); | |
| return d.reconciliation.ghostId; | |
| } | |
| module.exports={verifyRemoval}; | |