Views are now rollbacked if an error occurs, and unfinished views and
columns are deleted when an OBIDMS is opened.
This commit is contained in:
@ -100,6 +100,8 @@ typedef struct OBIDMS_column_header {
|
||||
*/
|
||||
Column_reference_t associated_column; /**< If there is one, the reference to the associated column.
|
||||
*/
|
||||
bool finished; /**< A boolean indicating whether the column was properly closed by the view that created it. TODO
|
||||
*/
|
||||
char comments[COMMENTS_MAX_LENGTH+1]; /**< Comments stored as a classical zero end C string.
|
||||
*/
|
||||
} OBIDMS_column_header_t, *OBIDMS_column_header_p;
|
||||
@ -142,6 +144,42 @@ typedef struct OBIDMS_column {
|
||||
} OBIDMS_column_t, *OBIDMS_column_p;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function building the full path to the version file of a column in an OBIDMS.
|
||||
*
|
||||
* @warning The returned pointer has to be freed by the caller.
|
||||
*
|
||||
* @param dms A pointer on the OBIDMS.
|
||||
* @param column_name The name of the OBIDMS column file.
|
||||
*
|
||||
* @returns A pointer to the version file name.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since October 2017
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_version_file_full_path(OBIDMS_p dms, const char* column_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function building the full path to the version file of a column in an OBIDMS.
|
||||
*
|
||||
* @warning The returned pointer has to be freed by the caller.
|
||||
*
|
||||
* @param dms A pointer on the OBIDMS.
|
||||
* @param column_name The name of the OBIDMS column file.
|
||||
* @param version_number The version number of the OBIDMS column file.
|
||||
*
|
||||
* @returns A pointer to the version file name.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since October 2017
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* obi_column_full_path(OBIDMS_p dms, const char* column_name, obiversion_t version_number);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns the latest version number of a column in a column directory using the column directory structure.
|
||||
*
|
||||
@ -277,6 +315,8 @@ int obi_clone_column_indexer(OBIDMS_column_p column);
|
||||
/**
|
||||
* @brief Truncates a column to the number of lines used if it is not read-only and closes it.
|
||||
*
|
||||
* @warning This function does not flag the column as finished, only finish_view() in the obiview source file does that.
|
||||
*
|
||||
* @param column A pointer on an OBIDMS column.
|
||||
*
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
@ -424,4 +464,21 @@ int obi_column_prepare_to_set_value(OBIDMS_column_p column, index_t line_nb, ind
|
||||
int obi_column_prepare_to_get_value(OBIDMS_column_p column, index_t line_nb);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Goes through all the column files of a DMS and deletes columns that have
|
||||
* not been flagged as finished (done by the finish_view() function in the
|
||||
* obiview source file).
|
||||
*
|
||||
* @param dms A pointer on an OBIDMS.
|
||||
*
|
||||
* @returns A value indicating the success of the operation.
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since October 2017
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_clean_unfinished_columns(OBIDMS_p dms);
|
||||
|
||||
|
||||
#endif /* OBIDMSCOLUMN_H_ */
|
||||
|
Reference in New Issue
Block a user