forked from lei.chen/myxce
Add the full call chain for host control operations from the Go API server through the C library to the controller: - schema/controller.capnp: HostControl struct + hostctrlmsg @21 in Request.body union - include/typemap.h: xce_hostctrl_t* hostctrlmsg in body union (placed after @20 clrpreasonmsg, matching capnp ordinal) - include/client.h, xceapi.h, request.h: declarations for xcecli_hostctrl, xce_hostctrl, xce_hostctrl_req - lib/client.c: xcecli_hostctrl (validate + delegate to xce_hostctrl) - lib/xceapi.c: xce_hostctrl (validate ctx state + send + wait reply) - lib/request.c: xce_hostctrl_req (validate hostname/empty/nil, accept only HOST_OPEN/HOST_CLOSE, reject HOST_TAG/UNTAG) - lib/helper.c: Request_body_hostctrlmsg cases in xce_request_body() and xce_request_msg_name() - controller/cluster.c: OPCode_hostcontrol dispatch - controller/include/cluster.h: do_hostcontrol_op declaration - controller/worker.c: do_hostcontrol_op + fix pre-existing goto-clean bug in worker_ctrl that leaked write lock and reference on HOST_OPEN/HOST_CLOSE no-op paths TDD: 8 xce_hostctrl_req validation tests (null ep, null ctrl, null/empty hostname, HOST_DO_NONE no-op, HOST_TAG/UNTAG reject, negative action reject, HOST_OPEN/CLOSE accept via xce_request). 116/116 xcelib tests pass. CGO_ENABLED=0 Go backend tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62 lines
2.5 KiB
C
62 lines
2.5 KiB
C
#if !defined(_REQUEST_H_)
|
|
|
|
#define _REQUEST_H_ 1
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "netio.h"
|
|
#include "typemap.h"
|
|
#include "utils.h"
|
|
#include "xce/types.h"
|
|
|
|
typedef struct {
|
|
int wait;
|
|
} reqbar_t;
|
|
|
|
typedef int (*xce_check_fn_t)(void*);
|
|
|
|
extern int xce_encode(xce_request_t*, io_packet_t*);
|
|
extern int xce_decode(io_packet_t*, xce_request_t*);
|
|
|
|
extern int xce_reply(endpoint_t*, xce_peerinfo_t*, xce_reply_t*);
|
|
extern int xce_hello_req(endpoint_t*, char*);
|
|
extern int xce_nop_req(endpoint_t*);
|
|
extern int xce_shutdown_req(endpoint_t*);
|
|
extern void init_reply_by_req(xce_reply_t*, xce_request_t*);
|
|
extern int xce_join_req(endpoint_t*, int, hostattrs_t*);
|
|
extern int xce_pushconfig_req(endpoint_t*, xce_peerinfo_t*, xce_configdata_t*);
|
|
extern int xce_push_data_req(endpoint_t*, xce_peerinfo_t*, xce_data_t*,
|
|
xce_check_fn_t, void*, int);
|
|
|
|
extern int xce_workerlist_req(endpoint_t*, xce_peerinfo_t*);
|
|
extern int xce_reply_workerlist(endpoint_t*, uint64_t, int, xce_peerinfo_t*,
|
|
xce_workerlist_t*);
|
|
extern int xce_jobdispatch_req(endpoint_t*, xce_job_dispatch_t*);
|
|
extern int xce_jobsubmit_req(endpoint_t*, xce_job_submit_t*);
|
|
extern int xce_reply_jobdispatch(endpoint_t*, uint64_t, int32_t,
|
|
xce_peerinfo_t*);
|
|
extern int xce_reply_jobid(endpoint_t*, int, uint64_t, uint64_t,
|
|
xce_peerinfo_t*);
|
|
extern int xce_joblist_req(endpoint_t*, xce_peerinfo_t*);
|
|
extern int xce_reply_joblist(endpoint_t*, uint64_t, int, xce_peerinfo_t*,
|
|
xce_job_list_t*);
|
|
extern int xce_startjob_req(endpoint_t*, xce_job_exec_t*);
|
|
extern int xce_clusterconf_req(endpoint_t*);
|
|
extern int xce_reply_clusterconf(endpoint_t*, uint64_t, int, xce_peerinfo_t*,
|
|
xce_clusterconf_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);
|
|
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*);
|
|
extern int xce_jobctrl_req(endpoint_t*, xce_jobctrl_t*);
|
|
extern int xce_queuectrl_req(endpoint_t*, xce_queuectrl_t*);
|
|
extern int xce_hostctrl_req(endpoint_t*, xce_hostctrl_t*);
|
|
extern int xce_runtask_req(endpoint_t*, xce_taskrun_t*);
|
|
extern int xce_set_pend_reason_req(endpoint_t*, xce_preason_set_t*);
|
|
extern int xce_clear_reason_req(endpoint_t*, xce_clear_reason_t*);
|
|
|
|
#endif
|