feat(scheduler-core): implement snapshot save and load (task 8.1)
Adds xce_sched_core_save_snapshot()/xce_sched_core_load_snapshot(), split across snapshot.c/snapshot_wire.c/snapshot_load.c (800-line cap) along real save/load/shared-helper boundaries. Serializes the full core state (config, jobs, queues, workers, resources, resvals, users, projects, prng_seed, internal_state) into/out of sched_snapshot_data_t (task 7.3's committed C mirror of the capnp SnapshotData struct) as plain in-memory structures -- no wire encoding here, that's a later task. After load, rebuilds the picker's private state by re-invoking its state-change hooks (queue updates, then job pushes) against the restored core state, matching xce_core_push_events()'s own hook-firing order; picker-private state itself is never stored in the snapshot. Adds a new prng_seed field to xce_sched_core_t -- requirements.md/ design.md both presuppose it but no prior task added it. Seeded to 0, no PRNG consumer wired yet (deliberately out of scope). Cross-core behavioral-equivalence proven directly: two independent cores, each with its own registered picker, save on one and load into a freshly-initialized other, both driven through an identical real session, decision sequences asserted identical in order. Found and fixed two real bugs along the way: a missing prng_seed restore in this task's own new code, and a genuine guard bug in already-committed core.c (sched_get_user()/sched_get_project() treating key_find()'s expected -ENOENT as fatal, silently breaking get-or-create for any new name) that also affects the live production path (make_sched_job(), JOBS_PUSH) -- a narrowly-scoped two-line fix, independently traced to the primitive level and confirmed correct by review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019dw5WnN3DXStaEaPYfACU1
This commit is contained in:
parent
7704710985
commit
1a32e63a86
10 changed files with 2383 additions and 4 deletions
|
|
@ -7,6 +7,9 @@ scheduler_srcs = [
|
|||
'src/core_session.c',
|
||||
'src/core_clock.c',
|
||||
'src/driver.c',
|
||||
'src/snapshot.c',
|
||||
'src/snapshot_wire.c',
|
||||
'src/snapshot_load.c',
|
||||
'src/decision.c',
|
||||
'src/schedobj.c',
|
||||
'src/plugin.c',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue