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

@ -9,6 +9,7 @@ cdef extern from "obidms.h" nogil:
bint little_endian
size_t file_size
size_t used_size
bint working
const_char_p comments
ctypedef OBIDMS_infos_t* OBIDMS_infos_p
@ -21,9 +22,10 @@ cdef extern from "obidms.h" nogil:
ctypedef OBIDMS_t* OBIDMS_p
int obi_dms_is_clean(OBIDMS_p dms)
int obi_clean_dms(const_char_p dms_path)
OBIDMS_p obi_dms(const_char_p dms_name)
OBIDMS_p obi_open_dms(const_char_p dms_path)
OBIDMS_p obi_open_dms(const_char_p dms_path, bint cleaning)
OBIDMS_p obi_test_open_dms(const_char_p dms_path)
OBIDMS_p obi_create_dms(const_char_p dms_path)
int obi_dms_exists(const char* dms_path)

View File

@ -7,3 +7,5 @@ cdef extern from "obierrno.h":
extern int OBI_LINE_IDX_ERROR
extern int OBI_ELT_IDX_ERROR
extern int OBIVIEW_ALREADY_EXISTS_ERROR
extern int OBIDMS_NOT_CLEAN
extern int OBIDMS_WORKING

View File

@ -50,7 +50,7 @@ cdef class DMS(OBIWrapper):
cdef DMS dms
cdef bytes dms_name_b = tobytes(dms_name)
if DMS.exists(dms_name_b) :
pointer = obi_open_dms(<const_char_p> dms_name_b)
pointer = obi_open_dms(<const_char_p> dms_name_b, False)
else :
pointer = obi_create_dms(<const_char_p> dms_name_b)
if pointer == NULL :
@ -87,7 +87,7 @@ cdef class DMS(OBIWrapper):
cdef OBIDMS_p pointer
cdef DMS dms
cdef bytes dms_name_b = tobytes(dms_name)
pointer = obi_open_dms(<const_char_p> dms_name_b)
pointer = obi_open_dms(<const_char_p> dms_name_b, False)
if pointer == NULL :
raise Exception("Failed opening an OBIDMS")
dms = OBIWrapper.new_wrapper(DMS, pointer)