feat(scheduler-sim-diagnostics): add read-only limit plugin accessors

limit_get_configured_limits()/limit_get_usage_instances() cross the limit
plugin's private-state boundary (plugin->data, previously unreachable outside
limit.c) via key_find on the name-keyed plugin registry, returning NULL when
the plugin is absent/uninitialized and a raw iterable kvmgr handle otherwise.
Pure reads only -- no allocation, mutation, or hook triggering. Foundation for
the upcoming `info limit` REPL command (task 1 of 5).

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-17 09:03:09 +00:00
parent 80e096b85e
commit 915c0e4435
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 255 additions and 1 deletions

View file

@ -114,6 +114,20 @@ extern int plugin_job_rusage_update(void*, xce_sched_job_t*,
extern int register_fcfs(void*);
extern int register_builtin_fcfs(void*);
extern int register_limit(void*);
/* limit_get_configured_limits/limit_get_usage_instances - scheduler-sim-
* diagnostics spec, Requirement Set 1 (Limit Plugin Accessor), task 1.
* Read-only crossing of the plugin-private-state boundary: each looks up
* the limit plugin ("xce_sched_limit") in core->plugins and returns the
* requested field of its private limit_plugin_data_t (plugins/limit.c) --
* a raw kvmgr handle, iterable via iter_make()/iter_next() -- or NULL if
* the plugin is not registered or not yet initialized (plugin->data ==
* NULL). Never allocates, mutates, or triggers plugin hooks; performs no
* locking beyond what key_find() already does internally. NULL is a
* semantic signal only ("nothing is configured yet"), not an error -- the
* caller decides what to display for it. */
extern var limit_get_configured_limits(xce_sched_core_t* core);
extern var limit_get_usage_instances(xce_sched_core_t* core);
extern int register_seqjob_allocator(void*);
extern int register_parjob_allocator(void*);