diff options
-rw-r--r-- | src/client.c | 4 | ||||
-rw-r--r-- | src/client_main.c | 2 | ||||
-rw-r--r-- | src/const.h | 8 | ||||
-rw-r--r-- | src/protocol.c | 26 | ||||
-rw-r--r-- | src/protocol.h | 16 | ||||
-rw-r--r-- | src/server.c | 18 | ||||
-rw-r--r-- | src/worker.c | 12 | ||||
-rw-r--r-- | test/py/test_repo.py | 2 |
8 files changed, 44 insertions, 44 deletions
diff --git a/src/client.c b/src/client.c index 8c6c597..eda4374 100644 --- a/src/client.c +++ b/src/client.c @@ -48,7 +48,7 @@ static int make_request(struct jsonrpc_request **request, int argc, const char * return -1; } - if (!strcmp(argv[0], CMD_RUN)) { + if (!strcmp(argv[0], CMD_QUEUE_RUN)) { if (argc != 3) return -1; @@ -57,7 +57,7 @@ static int make_request(struct jsonrpc_request **request, int argc, const char * if (ret < 0) return ret; - ret = run_request_create(request, run); + ret = request_create_queue_run(request, run); run_destroy(run); return ret; } diff --git a/src/client_main.c b/src/client_main.c index 15ad449..3baa932 100644 --- a/src/client_main.c +++ b/src/client_main.c @@ -27,7 +27,7 @@ const char *get_usage_string(void) return "[-h|--help] [-V|--version] [-v|--verbose] [-H|--host HOST] [-p|--port PORT] ACTION [ARG...]\n\ \n\ available actions:\n\ -\t" CMD_RUN " URL REV - schedule a CI run of repository at URL, revision REV"; +\t" CMD_QUEUE_RUN " URL REV - schedule a CI run of repository at URL, revision REV"; } static int parse_settings(struct settings *settings, int argc, char *argv[]) diff --git a/src/const.h b/src/const.h index 6928235..27dd1d3 100644 --- a/src/const.h +++ b/src/const.h @@ -15,9 +15,9 @@ extern const char *default_host; extern const char *default_port; extern const char *default_sqlite_path; -#define CMD_RUN "run" -#define CMD_NEW_WORKER "new-worker" -#define CMD_START "start" -#define CMD_FINISHED "finished" +#define CMD_QUEUE_RUN "queue-run" +#define CMD_NEW_WORKER "new-worker" +#define CMD_START_RUN "start-run" +#define CMD_FINISHED_RUN "finished-run" #endif diff --git a/src/protocol.c b/src/protocol.c index 8ee57e1..977ed6e 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -21,11 +21,11 @@ static const char *const run_key_id = "id"; static const char *const run_key_url = "url"; static const char *const run_key_rev = "rev"; -int run_request_create(struct jsonrpc_request **request, const struct run *run) +int request_create_queue_run(struct jsonrpc_request **request, const struct run *run) { int ret = 0; - ret = jsonrpc_request_create(request, 1, CMD_RUN, NULL); + ret = jsonrpc_request_create(request, 1, CMD_QUEUE_RUN, NULL); if (ret < 0) return ret; ret = jsonrpc_request_set_param_string(*request, run_key_url, run_get_url(run)); @@ -43,7 +43,7 @@ free_request: return ret; } -int run_request_parse(const struct jsonrpc_request *request, struct run **run) +int request_parse_queue_run(const struct jsonrpc_request *request, struct run **run) { int ret = 0; @@ -59,21 +59,21 @@ int run_request_parse(const struct jsonrpc_request *request, struct run **run) return run_create(run, 0, url, rev); } -int new_worker_request_create(struct jsonrpc_request **request) +int request_create_new_worker(struct jsonrpc_request **request) { return jsonrpc_notification_create(request, CMD_NEW_WORKER, NULL); } -int new_worker_request_parse(UNUSED const struct jsonrpc_request *request) +int request_parse_new_worker(UNUSED const struct jsonrpc_request *request) { return 0; } -int start_request_create(struct jsonrpc_request **request, const struct run *run) +int request_create_start_run(struct jsonrpc_request **request, const struct run *run) { int ret = 0; - ret = jsonrpc_notification_create(request, CMD_START, NULL); + ret = jsonrpc_notification_create(request, CMD_START_RUN, NULL); if (ret < 0) return ret; ret = jsonrpc_request_set_param_int(*request, run_key_id, run_get_id(run)); @@ -94,7 +94,7 @@ free_request: return ret; } -int start_request_parse(const struct jsonrpc_request *request, struct run **run) +int request_parse_start_run(const struct jsonrpc_request *request, struct run **run) { int ret = 0; @@ -118,12 +118,12 @@ static const char *const finished_key_run_id = "run_id"; static const char *const finished_key_ec = "exit_code"; static const char *const finished_key_data = "output"; -int finished_request_create(struct jsonrpc_request **request, int run_id, - const struct proc_output *output) +int request_create_finished_run(struct jsonrpc_request **request, int run_id, + const struct proc_output *output) { int ret = 0; - ret = jsonrpc_notification_create(request, CMD_FINISHED, NULL); + ret = jsonrpc_notification_create(request, CMD_FINISHED_RUN, NULL); if (ret < 0) return ret; ret = jsonrpc_request_set_param_int(*request, finished_key_run_id, run_id); @@ -151,8 +151,8 @@ free_request: return ret; } -int finished_request_parse(const struct jsonrpc_request *request, int *_run_id, - struct proc_output **_output) +int request_parse_finished_run(const struct jsonrpc_request *request, int *_run_id, + struct proc_output **_output) { int ret = 0; diff --git a/src/protocol.h b/src/protocol.h index 765e6cf..220eead 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -12,16 +12,16 @@ #include "process.h" #include "run_queue.h" -int run_request_create(struct jsonrpc_request **, const struct run *); -int run_request_parse(const struct jsonrpc_request *, struct run **); +int request_create_queue_run(struct jsonrpc_request **, const struct run *); +int request_parse_queue_run(const struct jsonrpc_request *, struct run **); -int new_worker_request_create(struct jsonrpc_request **); -int new_worker_request_parse(const struct jsonrpc_request *); +int request_create_new_worker(struct jsonrpc_request **); +int request_parse_new_worker(const struct jsonrpc_request *); -int start_request_create(struct jsonrpc_request **, const struct run *); -int start_request_parse(const struct jsonrpc_request *, struct run **); +int request_create_start_run(struct jsonrpc_request **, const struct run *); +int request_parse_start_run(const struct jsonrpc_request *, struct run **); -int finished_request_create(struct jsonrpc_request **, int run_id, const struct proc_output *); -int finished_request_parse(const struct jsonrpc_request *, int *run_id, struct proc_output **); +int request_create_finished_run(struct jsonrpc_request **, int run_id, const struct proc_output *); +int request_parse_finished_run(const struct jsonrpc_request *, int *run_id, struct proc_output **); #endif diff --git a/src/server.c b/src/server.c index 61e3136..37806c9 100644 --- a/src/server.c +++ b/src/server.c @@ -172,7 +172,7 @@ static void server_assign_run(struct server *server) struct jsonrpc_request *start_request = NULL; int ret = 0; - ret = start_request_create(&start_request, run); + ret = request_create_start_run(&start_request, run); if (ret < 0) goto exit; @@ -255,8 +255,8 @@ close: return ret; } -static int server_handle_cmd_run(const struct jsonrpc_request *request, - struct jsonrpc_response **response, void *_ctx) +static int server_handle_cmd_queue_run(const struct jsonrpc_request *request, + struct jsonrpc_response **response, void *_ctx) { struct cmd_conn_ctx *ctx = (struct cmd_conn_ctx *)_ctx; struct server *server = (struct server *)ctx->arg; @@ -264,7 +264,7 @@ static int server_handle_cmd_run(const struct jsonrpc_request *request, struct run *run = NULL; - ret = run_request_parse(request, &run); + ret = request_parse_queue_run(request, &run); if (ret < 0) return ret; @@ -288,8 +288,8 @@ destroy_run: return ret; } -static int server_handle_cmd_finished(const struct jsonrpc_request *request, - UNUSED struct jsonrpc_response **response, void *_ctx) +static int server_handle_cmd_finished_run(const struct jsonrpc_request *request, + UNUSED struct jsonrpc_response **response, void *_ctx) { struct cmd_conn_ctx *ctx = (struct cmd_conn_ctx *)_ctx; struct server *server = (struct server *)ctx->arg; @@ -298,7 +298,7 @@ static int server_handle_cmd_finished(const struct jsonrpc_request *request, int run_id = 0; struct proc_output *output; - ret = finished_request_parse(request, &run_id, &output); + ret = request_parse_finished_run(request, &run_id, &output); if (ret < 0) return ret; @@ -318,8 +318,8 @@ free_output: static struct cmd_desc commands[] = { {CMD_NEW_WORKER, server_handle_cmd_new_worker}, - {CMD_RUN, server_handle_cmd_run}, - {CMD_FINISHED, server_handle_cmd_finished}, + {CMD_QUEUE_RUN, server_handle_cmd_queue_run}, + {CMD_FINISHED_RUN, server_handle_cmd_finished_run}, }; static const size_t numof_commands = sizeof(commands) / sizeof(commands[0]); diff --git a/src/worker.c b/src/worker.c index a6ccc89..5a0804f 100644 --- a/src/worker.c +++ b/src/worker.c @@ -82,14 +82,14 @@ static int worker_set_stopping(UNUSED struct event_loop *loop, UNUSED int fd, UN return 0; } -static int worker_handle_cmd_start(const struct jsonrpc_request *request, - UNUSED struct jsonrpc_response **response, void *_ctx) +static int worker_handle_cmd_start_run(const struct jsonrpc_request *request, + UNUSED struct jsonrpc_response **response, void *_ctx) { struct cmd_conn_ctx *ctx = (struct cmd_conn_ctx *)_ctx; struct worker *worker = (struct worker *)ctx->arg; int ret = 0; - ret = start_request_parse(request, &worker->run); + ret = request_parse_start_run(request, &worker->run); if (ret < 0) return ret; @@ -97,7 +97,7 @@ static int worker_handle_cmd_start(const struct jsonrpc_request *request, } static struct cmd_desc commands[] = { - {CMD_START, worker_handle_cmd_start}, + {CMD_START_RUN, worker_handle_cmd_start_run}, }; static const size_t numof_commands = sizeof(commands) / sizeof(commands[0]); @@ -194,7 +194,7 @@ static int worker_do_run(struct worker *worker) struct jsonrpc_request *finished_request = NULL; - ret = finished_request_create(&finished_request, run_get_id(worker->run), result); + ret = request_create_finished_run(&finished_request, run_get_id(worker->run), result); if (ret < 0) goto free_output; @@ -231,7 +231,7 @@ static int worker_get_run(struct worker *worker) fd = ret; struct jsonrpc_request *new_worker_request = NULL; - ret = new_worker_request_create(&new_worker_request); + ret = request_create_new_worker(&new_worker_request); if (ret < 0) goto close; diff --git a/test/py/test_repo.py b/test/py/test_repo.py index ec04e6d..e500b9f 100644 --- a/test/py/test_repo.py +++ b/test/py/test_repo.py @@ -40,7 +40,7 @@ def client_runner_process(log_queue, client, runs_per_process, repo): with configure_logging_in_child(log_queue): logging.info('Executing %s clients', runs_per_process) for i in range(runs_per_process): - client.run('run', repo.path, 'HEAD') + client.run('queue-run', repo.path, 'HEAD') def _test_repo_internal(env, repo, numof_processes, runs_per_process): |