use clang-format to format code
This commit is contained in:
parent
2bad284582
commit
de090dce35
58 changed files with 8745 additions and 7237 deletions
|
|
@ -2,23 +2,21 @@
|
|||
#define _XCECD_DB_H
|
||||
|
||||
#include "sqlite3.h"
|
||||
#include "xcecd_worker_utils.h"
|
||||
#include "xcecd_utils.h"
|
||||
#include <stdint.h>
|
||||
#include "xcecd_worker_utils.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct sqlite3 xcecd_db_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @param db_path Path to the database file
|
||||
* @return true if success, false if failed
|
||||
*/
|
||||
bool xcecd_db_init(xcecd_db_t** db,
|
||||
const char* db_path);
|
||||
bool xcecd_db_init(xcecd_db_t** db, const char* db_path);
|
||||
|
||||
/**
|
||||
* @brief close the database
|
||||
|
|
@ -28,7 +26,7 @@ void xcecd_db_close(xcecd_db_t* db);
|
|||
|
||||
/**
|
||||
* @brief Insert a worker into the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @param worker_pid PID of the worker
|
||||
* @param worker_status Status of the worker
|
||||
|
|
@ -36,54 +34,47 @@ void xcecd_db_close(xcecd_db_t* db);
|
|||
* @param job_status Status of the job associated with the worker
|
||||
* @return true if success, false if failed
|
||||
*/
|
||||
bool xcecd_db_insert_worker(xcecd_db_t* db,
|
||||
int worker_pid,
|
||||
int worker_status,
|
||||
uint64_t job_id,
|
||||
int job_status);
|
||||
bool xcecd_db_insert_worker(xcecd_db_t* db, int worker_pid, int worker_status,
|
||||
uint64_t job_id, int job_status);
|
||||
|
||||
/**
|
||||
* @brief Update a worker in the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @param worker_pid PID of the worker
|
||||
* @param worker_status Status of the worker
|
||||
* @param job_status Status of the job associated with the worker
|
||||
* @return true if success, false if failed
|
||||
*/
|
||||
bool xcecd_db_update_worker(sqlite3* db,
|
||||
int worker_pid,
|
||||
int worker_status,
|
||||
bool xcecd_db_update_worker(sqlite3* db, int worker_pid, int worker_status,
|
||||
int job_status);
|
||||
|
||||
/**
|
||||
* @brief Delete a worker from the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @param worker_pid PID of the worker
|
||||
* @return true if success, false if failed
|
||||
*/
|
||||
bool xcecd_db_delete_worker(xcecd_db_t* db,
|
||||
int worker_pid);
|
||||
bool xcecd_db_delete_worker(xcecd_db_t* db, int worker_pid);
|
||||
|
||||
/**
|
||||
* @brief Get a worker from the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @param worker_pid PID of the worker
|
||||
* @return worker status if success, -1 if failed
|
||||
*/
|
||||
int xcecd_db_get_worker(xcecd_db_t* db,
|
||||
int worker_pid);
|
||||
int xcecd_db_get_worker(xcecd_db_t* db, int worker_pid);
|
||||
|
||||
/**
|
||||
* @brief Get running workers from the database
|
||||
*
|
||||
*
|
||||
* @param db Pointer to the database structure
|
||||
* @return Pointer to the worker list (db->worker_list) if success, NULL if failed
|
||||
* @return Pointer to the worker list (db->worker_list) if success, NULL if
|
||||
* failed
|
||||
*/
|
||||
bool xcecd_db_get_running_workers(xcecd_db_t* db,
|
||||
xcecd_worker_t** worker_list);
|
||||
bool xcecd_db_get_running_workers(xcecd_db_t* db, xcecd_worker_t** worker_list);
|
||||
|
||||
/**
|
||||
* @brief Check if the database is available
|
||||
|
|
@ -91,7 +82,6 @@ bool xcecd_db_get_running_workers(xcecd_db_t* db,
|
|||
* @param db_path Path to the database file
|
||||
* @return void and directly exit if the database is not available
|
||||
*/
|
||||
void xcecd_db_is_available(xcecd_db_t* db,
|
||||
const char* db_path);
|
||||
void xcecd_db_is_available(xcecd_db_t* db, const char* db_path);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue