reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
|
|
@ -9,8 +9,7 @@
|
|||
#include "utils.h"
|
||||
#include "xcectx.h"
|
||||
|
||||
static int handle_get_reply(xce_ctx_t* ctx,
|
||||
xce_reply_t* reply)
|
||||
static int handle_get_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
||||
{
|
||||
xce_data_t* getdata = reply->data.getdata;
|
||||
dataset_t* dataset = ctx->reply.u.get;
|
||||
|
|
@ -18,8 +17,7 @@ static int handle_get_reply(xce_ctx_t* ctx,
|
|||
return extract_data(dataset, getdata);
|
||||
}
|
||||
|
||||
static int handle_sub_reply(xce_ctx_t* ctx,
|
||||
xce_reply_t* reply)
|
||||
static int handle_sub_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
||||
{
|
||||
if (reply->data_which != RequestReply_data_jobid) {
|
||||
return -1;
|
||||
|
|
@ -29,8 +27,7 @@ static int handle_sub_reply(xce_ctx_t* ctx,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int handle_reply(xce_ctx_t* ctx,
|
||||
xce_reply_t* reply)
|
||||
static int handle_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
@ -48,8 +45,7 @@ static int handle_reply(xce_ctx_t* ctx,
|
|||
case OPCode_clusterconf:
|
||||
rc = -1;
|
||||
if (reply->data_which == RequestReply_data_clusterconf) {
|
||||
MOVE_PTR(ctx->reply.u.clusterconf,
|
||||
reply->data.clusterconf);
|
||||
MOVE_PTR(ctx->reply.u.clusterconf, reply->data.clusterconf);
|
||||
rc = 1;
|
||||
}
|
||||
break;
|
||||
|
|
@ -93,15 +89,15 @@ static int vtask_entry(vtask_t* task)
|
|||
} else {
|
||||
int callnext = 1;
|
||||
|
||||
if ((request.opcode == OPCode_push) && (request.body_which == Request_body_pushmsg)) {
|
||||
if ((request.opcode == OPCode_push)
|
||||
&& (request.body_which == Request_body_pushmsg)) {
|
||||
|
||||
if (ctx->dataset == NULL) {
|
||||
ctx->dataset = (dataset_t*)calloc(1, sizeof(dataset_t));
|
||||
ctx->dataset->table = request.body.pushmsg->table;
|
||||
}
|
||||
|
||||
callnext = extract_data(ctx->dataset,
|
||||
request.body.pushmsg);
|
||||
callnext = extract_data(ctx->dataset, request.body.pushmsg);
|
||||
if (callnext) {
|
||||
FREEUP(request.body.pushmsg);
|
||||
request.body_which = Request_body_datamsg;
|
||||
|
|
@ -200,9 +196,7 @@ static int handle_io(struct epoll_event* p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int xce_ctx_init(xce_ctx_t* ctx,
|
||||
char* name,
|
||||
char* key)
|
||||
int xce_ctx_init(xce_ctx_t* ctx, char* name, char* key)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -254,8 +248,7 @@ void xce_ctx_fini(xce_ctx_t* ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
int xce_ctx_set_handler(xce_ctx_t* ctx,
|
||||
xce_request_handler_t handler)
|
||||
int xce_ctx_set_handler(xce_ctx_t* ctx, xce_request_handler_t handler)
|
||||
{
|
||||
if ((ctx == NULL) || (handler == NULL)) {
|
||||
return -EINVAL;
|
||||
|
|
@ -265,8 +258,7 @@ int xce_ctx_set_handler(xce_ctx_t* ctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int xce_ctx_set_endpoint(xce_ctx_t* ctx,
|
||||
endpoint_t* ep)
|
||||
int xce_ctx_set_endpoint(xce_ctx_t* ctx, endpoint_t* ep)
|
||||
{
|
||||
if ((ctx == NULL) || (ep == NULL)) {
|
||||
return -EINVAL;
|
||||
|
|
@ -288,10 +280,8 @@ int xce_ctx_start(xce_ctx_t* ctx)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
endpoint_set_handler(ctx->ep,
|
||||
handle_io, ctx);
|
||||
rc = iomgr_monitor(&(ctx->iomgr),
|
||||
ctx->ep);
|
||||
endpoint_set_handler(ctx->ep, handle_io, ctx);
|
||||
rc = iomgr_monitor(&(ctx->iomgr), ctx->ep);
|
||||
if (rc < 0) {
|
||||
ctx->state = XCE_CTX_ERR;
|
||||
return rc;
|
||||
|
|
@ -312,8 +302,7 @@ int xce_ctx_stop(xce_ctx_t* ctx)
|
|||
}
|
||||
|
||||
if (ctx->ep != NULL) {
|
||||
iomgr_unmonitor(&(ctx->iomgr),
|
||||
ctx->ep);
|
||||
iomgr_unmonitor(&(ctx->iomgr), ctx->ep);
|
||||
ctx->ep = NULL;
|
||||
}
|
||||
iomgr_stop(&(ctx->iomgr));
|
||||
|
|
@ -323,8 +312,7 @@ int xce_ctx_stop(xce_ctx_t* ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int xce_wakeup(xce_ctx_t* ctx,
|
||||
int status)
|
||||
int xce_wakeup(xce_ctx_t* ctx, int status)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
@ -341,8 +329,7 @@ int xce_wakeup(xce_ctx_t* ctx,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int xce_try_wakeup(xce_ctx_t* ctx,
|
||||
int status)
|
||||
int xce_try_wakeup(xce_ctx_t* ctx, int status)
|
||||
{
|
||||
if (ctx == NULL) {
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue