* Den Speicher der Etappen davor lesen. * * Ein Artefakt aus der Zeit vor den Etappen traegt keinen Speicher; von ihm * ueberleben nur die Runden, denn die sind die Geschichte des Zyklus und nicht * die Messung. Der naechste Durchgang faengt dann hinter der letzten Runde an.
()
| 2611 | * die Messung. Der naechste Durchgang faengt dann hinter der letzten Runde an. |
| 2612 | */ |
| 2613 | function loadStore() { |
| 2614 | if (!existsSync(OUT_JSON)) { |
| 2615 | return emptyStore(); |
| 2616 | } |
| 2617 | try { |
| 2618 | const old = JSON.parse(readFileSync(OUT_JSON, 'utf8')); |
| 2619 | const rounds = Array.isArray(old.rounds) ? old.rounds : []; |
| 2620 | const kept = old.extras?.store; |
| 2621 | if (kept === undefined || kept === null) { |
| 2622 | return { ...emptyStore(), rounds, pass: rounds.length + 1 }; |
| 2623 | } |
| 2624 | if (kept.meta?.harnessRevision !== HARNESS_REVISION) { |
| 2625 | const lastPass = Number(rounds.at(-1)?.pass ?? rounds.length); |
| 2626 | return { |
| 2627 | ...emptyStore(), |
| 2628 | rounds, |
| 2629 | pass: lastPass + 1, |
| 2630 | meta: { ...kept.meta, harnessRevision: HARNESS_REVISION }, |
| 2631 | }; |
| 2632 | } |
| 2633 | return { |
| 2634 | ...emptyStore(), |
| 2635 | ...kept, |
| 2636 | rounds, |
| 2637 | states: kept.states ?? {}, |
| 2638 | filters: kept.filters ?? {}, |
| 2639 | stages: kept.stages ?? [], |
| 2640 | meta: { ...(kept.meta ?? {}), harnessRevision: HARNESS_REVISION }, |
| 2641 | agentReplayReadings: kept.agentReplayReadings ?? {}, |
| 2642 | pass: Number(kept.pass ?? rounds.length + 1), |
| 2643 | }; |
| 2644 | } catch { |
| 2645 | return emptyStore(); |
| 2646 | } |
| 2647 | } |
| 2648 | |
| 2649 | /** Welche Zustaende diese Etappe faehrt. */ |
| 2650 | function passHasProgress(store) { |