LCOV - code coverage report
Current view: top level - mlops-agent-1.8.8/daemon - mlops-agent-internal.c (source / functions) Coverage Total Hit
Test: ML-Agent 1.8.8-0 platform/core/ml/mlops-agent#0e4faa58c1cc32b200623d31b6d332da9f779b87 Lines: 76.5 % 17 13
Test Date: 2026-04-30 21:36:08 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /* SPDX-License-Identifier: Apache-2.0 */
       2              : /**
       3              :  * @file    mlops-agent-internal.c
       4              :  * @date    20 January 2025
       5              :  * @brief   Internal function for ml-agent interface.
       6              :  * @see     https://github.com/nnstreamer/deviceMLOps.MLAgent
       7              :  * @author  Jaeyun Jung <jy1210.jung@samsung.com>
       8              :  * @bug     No known bugs except for NYI items
       9              :  */
      10              : 
      11              : #include "log.h"
      12              : #include "mlops-agent-internal.h"
      13              : #include "mlops-agent-node.h"
      14              : #include "service-db-util.h"
      15              : 
      16              : /**
      17              :  * @brief Internal function to initialize mlops-agent interface.
      18              :  */
      19              : int
      20           19 : ml_agent_initialize (const char *db_path)
      21              : {
      22              :   int ret;
      23              : 
      24           19 :   if (!STR_IS_VALID (db_path) ||
      25           19 :       !g_file_test (db_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
      26            0 :     ml_loge ("Failed to initialize mlops-agent, database path (%s) is invalid.", db_path);
      27            0 :     return -EINVAL;
      28              :   }
      29              : 
      30           19 :   ret = svcdb_initialize (db_path);
      31           19 :   if (ret < 0)
      32            0 :     goto error;
      33              : 
      34           19 :   ret = mlops_node_initialize ();
      35              : 
      36           19 : error:
      37           19 :   if (ret < 0)
      38            0 :     ml_agent_finalize ();
      39           19 :   return ret;
      40              : }
      41              : 
      42              : /**
      43              :  * @brief Internal function to finalize mlops-agent interface.
      44              :  */
      45              : void
      46           19 : ml_agent_finalize (void)
      47              : {
      48           19 :   mlops_node_finalize ();
      49           19 :   svcdb_finalize ();
      50           19 : }
        

Generated by: LCOV version 2.4-0