From 32bea4675dd751c0d07aa1f348b1b7201794d884 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 4 Jul 2023 16:19:32 +0200 Subject: sqlite: store new runs in SQLite --- src/run_queue.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/run_queue.c') 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); -- cgit v1.2.3