iopsys-feed/obuspa/patches/1001-use-datamodel-caching.patch
2025-08-23 10:08:37 +05:30

66 lines
2.6 KiB
Diff

commit 7bb794c3d8bbdcf4aa39f8c28f1fabcda11487b9
Author: Vivek Kumar Dutta <vivek.dutta@iopsys.eu>
Date: Wed Apr 30 17:18:27 2025 +0530
1001-use-datamodel-caching.patch
Index: obuspa-10.0.7.0/src/core/cli_server.c
===================================================================
--- obuspa-10.0.7.0.orig/src/core/cli_server.c
+++ obuspa-10.0.7.0/src/core/cli_server.c
@@ -513,6 +513,7 @@ int CLI_SERVER_ExecuteCliCommand(char *c
SendCliResponse("WARNING: Discarding unused args: %s\n", args.vector[cli_cmd->max_args+1]);
}
+ vendor_create_dm_cache(NULL, 0);
// Process command
err = cli_cmd->exec_cmd(&args);
print_help = false;
@@ -672,6 +673,11 @@ int ExecuteCli_Version(str_vector_t *arg
int ExecuteCli_Get(str_vector_t *args)
{
combined_role_t *combined_role;
+
+ char *path[2] = {args->vector[1], 0};
+
+ vendor_create_dm_cache(path, 1);
+
#ifndef REMOVE_USP_BROKER
char *arg1;
Index: obuspa-10.0.7.0/src/core/data_model.h
===================================================================
--- obuspa-10.0.7.0.orig/src/core/data_model.h
+++ obuspa-10.0.7.0/src/core/data_model.h
@@ -417,5 +417,6 @@ int DM_PRIV_ReRegister_DBParam_Default(c
bool DM_PRIV_IsChildNodeOf(dm_node_t *node, dm_node_t *parent_node);
void DM_PRIV_GetAllEventsAndCommands(dm_node_t *node, str_vector_t *events, str_vector_t *commands);
+int vendor_create_dm_cache(char *paths[], int num_paths);
#endif
Index: obuspa-10.0.7.0/src/core/handle_get.c
===================================================================
--- obuspa-10.0.7.0.orig/src/core/handle_get.c
+++ obuspa-10.0.7.0/src/core/handle_get.c
@@ -129,6 +129,7 @@ void MSG_HANDLER_HandleGet(Usp__Msg *usp
goto exit;
}
+ vendor_create_dm_cache(path_exprs, num_path_expr);
// Calculate the number of hierarchical levels to traverse in the data model when performing partial path resolution
// NOTE: protocol buffer has depth as an unsigned quantity, but internally we use a signed number, so limit range to that of a signed number
depth = usp->body->request->get->max_depth;
Index: obuspa-10.0.7.0/src/core/msg_handler.c
===================================================================
--- obuspa-10.0.7.0.orig/src/core/msg_handler.c
+++ obuspa-10.0.7.0/src/core/msg_handler.c
@@ -987,6 +987,8 @@ int HandleUspMessage(Usp__Msg *usp, char
MSG_HANDLER_UspMsgTypeToString(usp->header->msg_type),
iso8601_cur_time(buf, sizeof(buf)) );
+ // Drop the cached data before processing next message
+ vendor_create_dm_cache(NULL, 0);
// Process the message
cur_msg_type = usp_msg_type;
switch(usp_msg_type)