flash_perf_rest

Directory

eXtremeDB_rt/samples/flash_perf_rest/

Description

This sample (similar to flash_perf) demonstrates interaction with xPanel via RESTrt for monitoring flash storage-related statistics.

The sample initiates the RESTrt service, creates a persistent database on a flash drive, populates it with data, performs lookups, and cleans up data. The performance of these operations is measured and can be monitored.

Used API

mcorest_initialize(), mcorest_start(), mcorest_shutdown()

Code snippet

    static void rest_loop_task(void *args) {
    
        MCO_RET rc;
        mco_sock_params_t s_params;
    
        mco_socket_params_init(&s_params);
        s_params.mode = MCO_SOCK_NON_BLOCKING;
    
        rc = mcorest_initialize(db_name, INTERFACE, PORT, &s_params);
        if (rc != MCO_S_OK) {
            printf("ERROR: mcorest_initialize() failed: %d (%s)\n", rc, mco_strerror(rc));
            return;
        }
    
        printf("Starting rest on port %d...\n", PORT);
        rc = mcorest_start();
        if (rc != MCO_S_OK) {
            printf("ERROR: mcorest_start() failed: %d (%s)\n", rc, mco_strerror(rc));
            return;
        }
    
        mcorest_shutdown();
        printf("REST loop task done\n");
    }

What to expect as an output