コード例 #1
0
ファイル: main.c プロジェクト: 26597925/ucmq
static int mq_init_store(void)
{
    memset(&g_info, '\0', sizeof(app_info_t));
    memset(&g_last_info, '\0', sizeof(app_info_t));

    /* UCMQ store open */
    if (!mq_qm_open_store())
    {
        log_error("Store Open fail");
        return RUN_STEP_STORE_INIT;
    }

    /* Get sum of all queue unread count */
    g_info.count = mq_qm_get_store_count();
    log_info("All queue's total unread msg count[%"PRIu64"]", g_info.count);
    
    return RUN_STEP_STORE_END;
}
コード例 #2
0
ファイル: mq_api.c プロジェクト: GengXuan/my_libucmq
bool mq_store_init(const char *log_path, const char *data_path)
{
    memset(&g_info, '\0', sizeof(app_info_t));
    memset(&g_last_info, '\0', sizeof(app_info_t));

    /* initial configure. */
    strcpy(g_mq_conf.data_file_path, data_path);
    strcpy(g_mq_conf.output_log_path, log_path);
#ifdef DISABLE_STORE_SPACE
    // g_mq_conf.res_store_space = 0;
#endif

    /* log open. */
    log_config_t log_conf;
    log_init_config(&log_conf);
    strcpy(log_conf.log_path, g_mq_conf.output_log_path);
    // log_conf.log_level = LOG_DEBUG;
    log_conf.log_level = LOG_INFO;
    if (log_init(&log_conf) != 0) {
        log_error("mq log init error.");
        return false;
    }

    /* UCMQ store open */
    log_info("Initial mq store.");
    if (!mq_qm_open_store())
    {
        log_error("Store Open fail");
        return false;
    }

    /* Get sum of all queue unread count */
    g_info.count = mq_qm_get_store_count();
    log_info("All queue's total unread msg count[%"PRIu64"]", g_info.count);

    return true;
}