aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/storage.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 18:29:26 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 20:51:17 +0200
commita892d9a21fb321b82cb74cba2ec617a4edd7e2c9 (patch)
tree1774a176d1fbed474e8bfeea044703461745e86a /src/storage.c
parenttcp_server: always clean up connection descriptors (diff)
downloadcimple-a892d9a21fb321b82cb74cba2ec617a4edd7e2c9.tar.gz
cimple-a892d9a21fb321b82cb74cba2ec617a4edd7e2c9.zip
storage: requeue old runs from storage on startup
Diffstat (limited to '')
-rw-r--r--src/storage.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index 7c59776..5eaf5e7 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -7,6 +7,7 @@
#include "storage.h"
#include "log.h"
+#include "run_queue.h"
#include "storage_sqlite.h"
#include <stddef.h>
@@ -16,6 +17,7 @@ typedef int (*storage_create_t)(struct storage *, const struct storage_settings
typedef void (*storage_destroy_t)(struct storage *);
typedef int (*storage_run_create_t)(struct storage *, const char *repo_url, const char *rev);
+typedef int (*storage_get_run_queue_t)(struct storage *, struct run_queue *);
struct storage_api {
storage_settings_destroy_t destroy_settings;
@@ -23,6 +25,7 @@ struct storage_api {
storage_destroy_t destroy;
storage_run_create_t run_create;
+ storage_get_run_queue_t get_run_queue;
};
static const struct storage_api apis[] = {
@@ -32,6 +35,7 @@ static const struct storage_api apis[] = {
storage_sqlite_destroy,
storage_sqlite_run_create,
+ storage_sqlite_get_run_queue,
},
};
@@ -90,3 +94,11 @@ int storage_run_create(struct storage *storage, const char *repo_url, const char
return -1;
return api->run_create(storage, repo_url, rev);
}
+
+int storage_get_run_queue(struct storage *storage, struct run_queue *queue)
+{
+ const struct storage_api *api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->get_run_queue(storage, queue);
+}