aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/storage.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 20:51:29 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 20:51:29 +0200
commitd4e47fdb640c3ddce285157eee88db899461fa3a (patch)
treeec11a0df88f6db64a6017db7bc7efcaefedd04ec /src/storage.c
parentstorage: requeue old runs from storage on startup (diff)
downloadcimple-d4e47fdb640c3ddce285157eee88db899461fa3a.tar.gz
cimple-d4e47fdb640c3ddce285157eee88db899461fa3a.zip
storage: mark completed runs as such
Diffstat (limited to 'src/storage.c')
-rw-r--r--src/storage.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index 5eaf5e7..5df9843 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -17,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_run_finished_t)(struct storage *, int repo_id, int ec);
typedef int (*storage_get_run_queue_t)(struct storage *, struct run_queue *);
struct storage_api {
@@ -25,6 +26,7 @@ struct storage_api {
storage_destroy_t destroy;
storage_run_create_t run_create;
+ storage_run_finished_t run_finished;
storage_get_run_queue_t get_run_queue;
};
@@ -35,6 +37,7 @@ static const struct storage_api apis[] = {
storage_sqlite_destroy,
storage_sqlite_run_create,
+ storage_sqlite_run_finished,
storage_sqlite_get_run_queue,
},
};
@@ -95,6 +98,14 @@ int storage_run_create(struct storage *storage, const char *repo_url, const char
return api->run_create(storage, repo_url, rev);
}
+int storage_run_finished(struct storage *storage, int run_id, int ec)
+{
+ const struct storage_api *api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->run_finished(storage, run_id, ec);
+}
+
int storage_get_run_queue(struct storage *storage, struct run_queue *queue)
{
const struct storage_api *api = get_api(storage->type);