summaryrefslogtreecommitdiffstats
path: root/src/json.h
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-21 16:34:34 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-30 11:16:13 +0200
commitefb5f2758506ef875e376e40e978b1f03bf0ef8c (patch)
tree01131c88d714493c991dfc1e4ab08e70810b4097 /src/json.h
parenta3af24d94a5a0881169e00cf7d02cdcd5bf6bfc7 (diff)
client: store image cache data in database
Parse the 'cache' field of the refresh payload sent by the clients. Cache field structure in the payload: { ... 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}, ] ... } Store that data in the 'cache' table of the database so it can be obtained later on. The table contains the following fields: - clientid: the numeric identifier of the client. - imagename: name of the image in cache. - size: size in bytes of the image in cache. - checksum: checksum of the image in cache.
Diffstat (limited to 'src/json.h')
-rw-r--r--src/json.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/json.h b/src/json.h
index e37f1b2..d3838cf 100644
--- a/src/json.h
+++ b/src/json.h
@@ -132,4 +132,18 @@ struct og_procedure {
int og_json_parse_procedure(json_t *element, struct og_procedure *proc);
+#define OG_PARAM_IMG_NAME (1UL << 0)
+#define OG_PARAM_IMG_SIZE (1UL << 1)
+#define OG_PARAM_IMG_CHECKSUM (1UL << 2)
+
+struct og_cache_image {
+ const char *name;
+ uint64_t size;
+ const char *checksum;
+ struct list_head list;
+};
+
+void og_cache_image_free(struct list_head *cache_list);
+int og_json_parse_cache(json_t *element, struct list_head *cache_list);
+
#endif