From 532b3ae9b5cd8609237e04db768cc1f750d8631d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 25 Aug 2022 16:58:38 +0200 Subject: add some more code This adds a basic "worker" program. You can now do something like ./server & ./worker & ./client ci_run URL REV and the server should pass a message to worker, after which it should clone the repository at URL, checkout REV, and try to run the CI script. It's extremely unfinished: I need to sort out the graceful shutdown, how the server manages workers, etc. --- src/ci_queue.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/ci_queue.h (limited to 'src/ci_queue.h') diff --git a/src/ci_queue.h b/src/ci_queue.h new file mode 100644 index 0000000..d036376 --- /dev/null +++ b/src/ci_queue.h @@ -0,0 +1,27 @@ +#ifndef __CI_QUEUE_H__ +#define __CI_QUEUE_H__ + +#include + +struct ci_queue_entry { + char *url; + char *rev; + STAILQ_ENTRY(ci_queue_entry) entries; +}; + +int ci_queue_entry_create(struct ci_queue_entry **, const char *url, const char *rev); +void ci_queue_entry_destroy(struct ci_queue_entry *); + +STAILQ_HEAD(ci_queue, ci_queue_entry); + +void ci_queue_create(struct ci_queue *); +void ci_queue_destroy(struct ci_queue *); + +int ci_queue_is_empty(const struct ci_queue *); + +void ci_queue_push(struct ci_queue *, struct ci_queue_entry *); +void ci_queue_push_head(struct ci_queue *, struct ci_queue_entry *); + +struct ci_queue_entry *ci_queue_pop(struct ci_queue *); + +#endif -- cgit v1.2.3