aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/run_queue.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 15:31:33 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 15:32:17 +0200
commit7cd83e15139447156ca915ce2d9d19295c146d56 (patch)
tree277f35dcc6c59d93cf5ef0232daa525079342f97 /src/run_queue.h
parentcommand: adjust order of parameters to handlers (diff)
downloadcimple-7cd83e15139447156ca915ce2d9d19295c146d56.tar.gz
cimple-7cd83e15139447156ca915ce2d9d19295c146d56.zip
rework server-worker communication
OK, this is a major rework. * tcp_server: connection threads are not detached anymore, the caller has to clean them up. This was done so that the server can clean up the threads cleanly. * run_queue: simple refactoring, run_queue_entry is called just run now. * server: worker threads are now killed when a run is assigned to a worker. * worker: the connection to server is no longer persistent. A worker sends "new-worker", waits for a task, closes the connection, and when it's done, sends the "complete" message and waits for a new task. This is supposed to improve resilience, since the worker-server connections don't have to be maintained while the worker is doing a CI run.
Diffstat (limited to '')
-rw-r--r--src/run_queue.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/run_queue.h b/src/run_queue.h
index 629a8e0..eca071e 100644
--- a/src/run_queue.h
+++ b/src/run_queue.h
@@ -8,26 +8,29 @@
#ifndef __RUN_QUEUE_H__
#define __RUN_QUEUE_H__
+#include "msg.h"
+
#include <sys/queue.h>
-struct run_queue_entry;
+struct run;
-int run_queue_entry_create(struct run_queue_entry **, const char *url, const char *rev);
-void run_queue_entry_destroy(struct run_queue_entry *);
+int run_create(struct run **, const char *url, const char *rev);
+int run_from_msg(struct run **, const struct msg *);
+void run_destroy(struct run *);
-const char *run_queue_entry_get_url(const struct run_queue_entry *);
-const char *run_queue_entry_get_rev(const struct run_queue_entry *);
+const char *run_get_url(const struct run *);
+const char *run_get_rev(const struct run *);
-STAILQ_HEAD(run_queue, run_queue_entry);
+STAILQ_HEAD(run_queue, run);
void run_queue_create(struct run_queue *);
void run_queue_destroy(struct run_queue *);
int run_queue_is_empty(const struct run_queue *);
-void run_queue_add_first(struct run_queue *, struct run_queue_entry *);
-void run_queue_add_last(struct run_queue *, struct run_queue_entry *);
+void run_queue_add_first(struct run_queue *, struct run *);
+void run_queue_add_last(struct run_queue *, struct run *);
-struct run_queue_entry *run_queue_remove_first(struct run_queue *);
+struct run *run_queue_remove_first(struct run_queue *);
#endif