initial work of api server

This commit is contained in:
Rongsong Shen 2026-01-20 18:20:24 +08:00
parent 280c22671f
commit 70970434ca
13 changed files with 394 additions and 9 deletions

View file

@ -117,6 +117,24 @@ static int handle_controller_join(cluster_t* c, endpoint_t* ep,
return rc;
}
static int handle_apiserver_join(cluster_t *c, endpoint_t *ep, xce_request_t *request) {
xce_reply_t reply;
ep_private_t *priv = (ep_private_t *)ep->data;
int rc = 0;
TRACE("%s api server join, ep %p", __func__, ep);
init_reply_by_req(&reply, request);
rc = on_apiserver_join(c, ep);
reply.status = rc;
reply.data_which = RequestReply_data_nodata;
xce_reply(ep, c->myhost, &reply);
return 0;
}
static int handle_join_(cluster_t* c, endpoint_t* ep, xce_request_t* request)
{
ep_private_t* priv;
@ -158,6 +176,9 @@ static int handle_join_(cluster_t* c, endpoint_t* ep, xce_request_t* request)
case HostRole_controller:
rc = handle_controller_join(c, ep, request);
break;
case HostRole_apiserver:
rc = handle_apiserver_join(c, ep, request);
break;
default:
rc = -E_XCE_BAD_ROLE;
ERROR("unknown role %d from host %s", role, from->name);