feat(worker-rejoin-resync): add reconciliation wire codec helpers (task 1.4)

Add xce_job_state_query_req()/xce_job_state_report_req() to request.c,
paginating job IDs / job-state entries across OPCode_jobStateQuery /
OPCode_jobStateReport messages via direct Request.body union arms
(mirroring xce_jobdispatch_req/xce_notify_req's direct-send shape, not
xce_push_data_req's XceData-table multiplexing -- these are dedicated
union arms, not multiplexed push/reply-get traffic). 8 round-trip tests
(normal/empty/multi-page for both query and report, covering all 4
JobStateStatus values and both queried states) all pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4M5MJM2zK6nU43da267Ku
This commit is contained in:
Rongsong Shen 2026-09-01 09:34:25 +00:00
parent 9fbbd12b36
commit 9f3dfe7903
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
6 changed files with 581 additions and 1 deletions

View file

@ -60,6 +60,31 @@ extern int xce_ctrlstatus_req(endpoint_t*);
extern int xce_get_req(endpoint_t*, xce_get_t*);
extern int xce_reply_get(endpoint_t*, xce_peerinfo_t*, xce_reply_t*,
xce_check_fn_t, void*, int);
/*
* xce_job_state_query_req / xce_job_state_report_req: send the worker-rejoin-
* resync job-state reconciliation exchange's paginated request/reply pair
* (worker-rejoin-resync task 1.4, Req 8.1/8.2/8.3) --
* OPCode_jobStateQuery (controller -> worker, query->jobids) and
* OPCode_jobStateReport (worker -> controller, report->entries) -- using the
* same {pos,count,ntotal} pagination idiom as xce_push_data_req()/
* xce_reply_get() above: `pktlimit <= 0` sends the whole list in one page;
* a zero-length list still sends exactly one page with count == 0 (an empty
* page is a valid, complete exchange, not something to skip). The receiving
* side decodes each page with the generic xce_decode() -- these opcodes are
* their own dedicated Request body union arms (jobstatequerymsg/
* jobstatereportmsg, added by task 1.1's schema), not multiplexed through
* xce_data_t, so encode/decode of each page's payload is already handled by
* the generated encode_JobStateQuery()/encode_JobStateReport() (controller.capnp.c)
* that xce_encode()/xce_decode() call into.
*/
extern int xce_job_state_query_req(endpoint_t*, xce_peerinfo_t*,
xce_job_state_query_t*,
xce_check_fn_t, void*, int);
extern int xce_job_state_report_req(endpoint_t*, xce_peerinfo_t*,
xce_job_state_report_t*,
xce_check_fn_t, void*, int);
extern int xce_notify_req(endpoint_t*, xce_notify_data_t*);
extern int extract_data(dataset_t*, xce_data_t*);
extern int xce_update_req(endpoint_t*, xce_update_data_t*);