From efb5f2758506ef875e376e40e978b1f03bf0ef8c Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 21 May 2024 16:34:34 +0200 Subject: 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. --- src/json.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/json.h') 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 -- cgit v1.2.3-18-g5258