feat(scheduler-sim-live-allocation): make plugin hook dispatch core-safe (task 1.2)

Re-types plugin_job_election()/plugin_prepare_allocation()/
plugin_commit_decision() from (void* arg, ...) to (xce_sched_core_t*
core, ...), iterating core->plugins directly instead of deriving it
from a normal-mode-only driver struct -- mirroring
plugin_begin_session()/plugin_end_session()'s already-completed
migration.

Adds a new, honestly-typed xce_sched_plugin_t.core field, set by both
plugin_register() (normal mode) and plugin_register_core() (simulation
mode, closing a gap left since bug-1825 where this path set nothing).
The existing plugin->sched field and its plugins/fcfs.c legacy
consumer are left untouched.

Necessarily updates the 4 existing normal-mode call sites (scheduler.c,
resource.c, schedobj.c) to pass &(...->core) -- a C signature migration
cannot keep the build green without touching every caller in the same
commit; each fix is a minimal argument wrap with no algorithm change,
matching design.md's own Implementation Notes for this component.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-18 11:48:08 +00:00
parent 89297dc825
commit e8866641a6
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
18 changed files with 403 additions and 34 deletions

View file

@ -81,7 +81,7 @@ void plugin_unregister(void* arg) { (void)arg; }
* the real production call sequence's two prepare_allocation() calls per
* host try (once at ctx->worker==NULL via sched_ctx_set_primary(), again
* per host at ctx->worker!=NULL), since xvec_idval_store() never dedups. */
int plugin_prepare_allocation(void* sched, xce_sched_ctx_t* ctx)
int plugin_prepare_allocation(xce_sched_core_t* sched, xce_sched_ctx_t* ctx)
{
xce_sched_plugin_t fake_plugin;