client: update cache after image/restore

Update the database with the new cache contents sent by the
client after an image/restore operation.

Resquest response structure:
{
    ...
    'cache': [
        {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'},
        {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'}
    ]
    ...
}

Parse the contents of the 'cache' field to update the data of
the client's cache in the database.
This is one of the required changes the make cache/list coherent
and prevent cache desync between the server and clients.
master v1.2.5-11
Alejandro Sirgo Rica 2024-05-24 14:17:03 +02:00
parent 111f077d17
commit 51f275a867
1 changed files with 2 additions and 0 deletions

View File

@ -1065,6 +1065,8 @@ int og_agent_state_process_response(struct og_client *cli)
break;
case OG_CMD_IMAGE_RESTORE:
err = og_resp_image_restore(root, cli);
if (!err)
err = og_resp_update_cache(root, cli);
break;
case OG_CMD_CACHE_DELETE:
err = og_resp_update_cache(root, cli);