From 479998d76f805c02e041adb209857d4ca6b3f87f Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 31 Oct 2024 00:27:57 +0100 Subject: src: add last client command context and use it for image creation Add last client command context that is used in the request to client. This allows to remove the stub image entry in the database in case that the image creation fails. --- src/rest.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/rest.h') diff --git a/src/rest.h b/src/rest.h index ff1486b..be5b17a 100644 --- a/src/rest.h +++ b/src/rest.h @@ -51,6 +51,14 @@ enum og_cmd_result { OG_SUCCESS = 2, }; +struct og_cmd_ctx { + union { + struct { + uint32_t id; + } image; + }; +}; + #define OG_MSG_REQUEST_MAXLEN 131072 struct og_client { @@ -70,6 +78,7 @@ struct og_client { enum og_cmd_type type; unsigned int id; enum og_cmd_result result; + struct og_cmd_ctx ctx; } last_cmd; uint32_t speed; uint32_t seq; @@ -159,7 +168,7 @@ enum og_rest_method { int og_send_request(enum og_rest_method method, enum og_cmd_type type, const struct og_msg_params *params, - const json_t *data); + const json_t *data, const struct og_cmd_ctx *ctx); int og_dbi_scope_get(struct og_dbi *dbi, json_t *array); -- cgit v1.2.3-18-g5258