DMS are now locked when used by a command. Added checks and changed

cleaning mechanisms.
This commit is contained in:
Celine Mercier
2019-09-20 20:37:19 +02:00
parent eb6c59dc1e
commit 783a1343c4
14 changed files with 378 additions and 28 deletions

View File

@ -88,6 +88,8 @@ typedef struct OBIDMS_infos {
*/
size_t used_size; /**< Used size in bytes.
*/
bool working; /**< If the DMS is currently working (being used by a process).
*/
char comments[]; /**< Comments, additional informations on the DMS including
* the command line history.
*/
@ -146,6 +148,37 @@ extern OBIDMS_p global_opened_dms_list[MAX_NB_OPENED_DMS+1];
extern int global_opened_dms_counter_list[MAX_NB_OPENED_DMS+1];
/**
* @brief Checks if an OBIDMS contains unfinished views or columns.
*
* @param dms A pointer on the DMS.
*
* @returns An integer value indicating whether the DMS is clean or not.
* @retval 1 if the DMS is clean.
* @retval 0 if the DMS contains unfinished views or columns.
* @retval -1 if an error occurred.
*
* @since September 2019
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_dms_is_clean(OBIDMS_p dms);
/**
* @brief Cleans an OBIDMS that contains unfinished views or columns and tags it as not working
* (not being used by a process).
*
* @param dms_path A pointer to a C string containing the path to the DMS.
*
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since September 2019
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_clean_dms(const char* dms_path);
/**
* @brief Checks if an OBIDMS exists.
*
@ -189,6 +222,7 @@ OBIDMS_p obi_create_dms(const char* dms_name);
* @brief Opens an existing OBITools Data Management instance (OBIDMS).
*
* @param dms_path A pointer to a C string containing the path to the database.
* @param cleaning A boolean indicating whether the DMS is being opened for cleaning unfinished views and columns.
*
* @returns A pointer to an OBIDMS structure describing the opened DMS.
* @retval NULL if an error occurred.
@ -197,7 +231,7 @@ OBIDMS_p obi_create_dms(const char* dms_name);
* @since May 2015
* @author Eric Coissac (eric.coissac@metabarcoding.org)
*/
OBIDMS_p obi_open_dms(const char* dms_path);
OBIDMS_p obi_open_dms(const char* dms_path, bool cleaning);
/**