aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ci_queue.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-25 16:58:38 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-26 04:05:02 +0200
commit532b3ae9b5cd8609237e04db768cc1f750d8631d (patch)
treef65253a6ce9970d1d93e6bb6c65758d6fa98373a /src/ci_queue.h
parentcmake: ignore unused parameters for now (diff)
downloadcimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.tar.gz
cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.zip
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.
Diffstat (limited to 'src/ci_queue.h')
-rw-r--r--src/ci_queue.h27
1 files changed, 27 insertions, 0 deletions
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 <sys/queue.h>
+
+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