aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/run_queue.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 16:19:32 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 16:19:32 +0200
commit32bea4675dd751c0d07aa1f348b1b7201794d884 (patch)
tree01be1e7ee7b55086a3f278a55cc26964fa20320c /src/run_queue.c
parentstorage_sqlite: refactoring (diff)
downloadcimple-32bea4675dd751c0d07aa1f348b1b7201794d884.tar.gz
cimple-32bea4675dd751c0d07aa1f348b1b7201794d884.zip
sqlite: store new runs in SQLite
Diffstat (limited to 'src/run_queue.c')
-rw-r--r--src/run_queue.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/run_queue.c b/src/run_queue.c
index a00f986..8bfa816 100644
--- a/src/run_queue.c
+++ b/src/run_queue.c
@@ -16,10 +16,11 @@
struct run {
char *url;
char *rev;
+ int id;
SIMPLEQ_ENTRY(run) entries;
};
-int run_create(struct run **_entry, const char *_url, const char *_rev)
+int run_create(struct run **_entry, const char *_url, const char *_rev, int id)
{
struct run *entry = malloc(sizeof(struct run));
if (!entry) {
@@ -41,6 +42,7 @@ int run_create(struct run **_entry, const char *_url, const char *_rev)
entry->url = url;
entry->rev = rev;
+ entry->id = id;
*_entry = entry;
return 0;
@@ -66,7 +68,8 @@ int run_from_msg(struct run **run, const struct msg *msg)
}
const char **argv = msg_get_strings(msg);
- return run_create(run, argv[1], argv[2]);
+ /* We don't know the ID yet. */
+ return run_create(run, argv[1], argv[2], 0);
}
void run_destroy(struct run *entry)
@@ -86,6 +89,16 @@ const char *run_get_rev(const struct run *entry)
return entry->rev;
}
+int run_get_id(const struct run *entry)
+{
+ return entry->id;
+}
+
+void run_set_id(struct run *entry, int id)
+{
+ entry->id = id;
+}
+
void run_queue_create(struct run_queue *queue)
{
SIMPLEQ_INIT(queue);