docs(scheduler-allocation): fix xce_host_iter_t.next() return type

Found during task 1.1 implementation: the Data Structure Changes
Summary declared next() returning xce_worker_t* (the wire/config
type), but the Composition Algorithm pseudocode in the same document
already used xce_sched_worker_t* (the scheduler-internal type with
resvals/resInUse/host_eval_ctx) for the identical call -- these are
genuinely different types in this codebase, confirmed via
make_sched_worker()'s xce_worker_t* -> xce_sched_worker_t* conversion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
Rongsong Shen 2026-09-04 13:26:18 +00:00
parent 48c789dfcb
commit d1a3e158ae
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 18 additions and 2 deletions

View file

@ -276,9 +276,15 @@ struct xce_alloc_plan_iter_s {
##### Service Interface
```c
/* Correction (found during task 1.1 implementation): next() returns
* xce_sched_worker_t* (sched/types.h -- resvals/resInUse/host_eval_ctx),
* not xce_worker_t* (xce/types.h -- the wire/config type make_sched_worker()
* converts FROM). requirements.md's own Composition Algorithm pseudocode
* already used xce_sched_worker_t*; this struct declaration was out of
* sync with it. */
struct xce_host_iter_s {
int (*init)(xce_host_iter_t* iter, xce_alloc_plan_t* plan, var workers);
xce_worker_t* (*next)(xce_host_iter_t* iter);
xce_sched_worker_t* (*next)(xce_host_iter_t* iter);
void (*fini)(xce_host_iter_t* iter);
void* private;
};

View file

@ -425,6 +425,16 @@ typedef struct {
```c
typedef struct xce_host_iter_s xce_host_iter_t;
// Correction (found during task 1.1 implementation): next() returns
// xce_sched_worker_t* (sched/types.h -- the scheduler-internal type
// carrying resvals/resInUse/host_eval_ctx), NOT xce_worker_t* (xce/types.h
// -- the wire/config type make_sched_worker() converts FROM). This
// Composition Algorithm's own pseudocode already uses
// `xce_sched_worker_t* w = host_iter->next(host_iter)` -- this struct
// declaration was simply out of sync with it. sched_check_host_satisfy()/
// sched_meet_host_selection() (resource.c), which any real host_iter
// implementation must call, both take xce_sched_worker_t*, not
// xce_worker_t*.
struct xce_host_iter_s {
// Initialize the iterator for a given plan and worker set.
// Returns 0 on success, nonzero on error.
@ -434,7 +444,7 @@ struct xce_host_iter_s {
// Return the next candidate worker matching the plan's host filter,
// or NULL when exhausted. The returned worker pointer is valid until
// the next next() or fini() call.
xce_worker_t* (*next)(xce_host_iter_t* iter);
xce_sched_worker_t* (*next)(xce_host_iter_t* iter);
// Release all resources held by the iterator.
void (*fini)(xce_host_iter_t* iter);