Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
d8107533
Commit
d8107533
authored
Apr 12, 2016
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Obiblob_indexer API
parent
cd4e65e1
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
252 additions
and
131 deletions
+252
-131
python/obitools3/obidms/_obidms.cfiles
python/obitools3/obidms/_obidms.cfiles
+4
-0
python/obitools3/obidms/_obidms.pxd
python/obitools3/obidms/_obidms.pxd
+1
-1
python/obitools3/obidms/_obidms.pyx
python/obitools3/obidms/_obidms.pyx
+2
-2
python/obitools3/obidms/capi/obidmscolumn.pxd
python/obitools3/obidms/capi/obidmscolumn.pxd
+2
-2
python/obitools3/obidms/capi/obiview.pxd
python/obitools3/obidms/capi/obiview.pxd
+1
-1
src/obiavl.c
src/obiavl.c
+23
-23
src/obiavl.h
src/obiavl.h
+1
-0
src/obiblob_indexer.c
src/obiblob_indexer.c
+37
-0
src/obiblob_indexer.h
src/obiblob_indexer.h
+78
-0
src/obidms.c
src/obidms.c
+22
-22
src/obidms.h
src/obidms.h
+20
-20
src/obidmscolumn.c
src/obidmscolumn.c
+16
-16
src/obidmscolumn.h
src/obidmscolumn.h
+6
-6
src/obidmscolumn_seq.c
src/obidmscolumn_seq.c
+4
-4
src/obidmscolumn_seq.h
src/obidmscolumn_seq.h
+8
-8
src/obidmscolumn_str.c
src/obidmscolumn_str.c
+6
-6
src/obidmscolumn_str.h
src/obidmscolumn_str.h
+8
-8
src/obierrno.h
src/obierrno.h
+3
-1
src/obitypes.h
src/obitypes.h
+1
-2
src/obiview.c
src/obiview.c
+5
-5
src/obiview.h
src/obiview.h
+4
-4
No files found.
python/obitools3/obidms/_obidms.cfiles
View file @
d8107533
...
...
@@ -28,3 +28,7 @@
../../../src/crc64.h
../../../src/utils.c
../../../src/utils.h
../../../src/obiblob.c
../../../src/obiblob.h
../../../src/obiblob_indexer.c
../../../src/obiblob_indexer.h
python/obitools3/obidms/_obidms.pxd
View file @
d8107533
...
...
@@ -56,7 +56,7 @@ cdef class OBIView:
index_t
nb_lines
=*
,
index_t
nb_elements_per_line
=*
,
list
elements_names
=*
,
str
avl
_name
=*
,
str
indexer
_name
=*
,
str
comments
=*
,
bint
create
=*
)
...
...
python/obitools3/obidms/_obidms.pyx
View file @
d8107533
...
...
@@ -352,7 +352,7 @@ cdef class OBIView :
index_t
nb_lines
=
0
,
index_t
nb_elements_per_line
=
1
,
# TODO 1?
list
elements_names
=
None
,
str
avl_name
=
"default_AVL_tree
"
,
str
indexer_name
=
"default_indexer
"
,
str
comments
=
""
,
bint
create
=
True
# TODO
)
:
...
...
@@ -388,7 +388,7 @@ cdef class OBIView :
if
(
obi_view_add_column
(
self
.
pointer
,
column_name_b
,
version_number
,
# should return pointer on column?
data_type
,
nb_lines
,
nb_elements_per_line
,
elements_names_b
,
str2bytes
(
avl
_name
),
elements_names_b
,
str2bytes
(
indexer
_name
),
str2bytes
(
comments
),
create
)
<
0
)
:
raise
Exception
(
"Problem adding a column in a view"
)
...
...
python/obitools3/obidms/capi/obidmscolumn.pxd
View file @
d8107533
...
...
@@ -27,7 +27,7 @@ cdef extern from "obidmscolumn.h" nogil:
obiversion_t
version
obiversion_t
cloned_from
const_char_p
name
const_char_p
avl
_name
const_char_p
indexer
_name
const_char_p
comments
ctypedef
OBIDMS_column_header_t
*
OBIDMS_column_header_p
...
...
@@ -45,7 +45,7 @@ cdef extern from "obidmscolumn.h" nogil:
index_t
nb_lines
,
index_t
nb_elements_per_line
,
const_char_p
elements_names
,
const_char_p
avl
_name
,
const_char_p
indexer
_name
,
const_char_p
comments
)
OBIDMS_column_p
obi_open_column
(
OBIDMS_p
dms
,
...
...
python/obitools3/obidms/capi/obiview.pxd
View file @
d8107533
...
...
@@ -90,7 +90,7 @@ cdef extern from "obiview.h" nogil:
index_t
nb_lines
,
index_t
nb_elements_per_line
,
const_char_p
elements_names
,
const_char_p
avl
_name
,
const_char_p
indexer
_name
,
const_char_p
comments
,
bint
create
)
...
...
src/obiavl.c
View file @
d8107533
...
...
@@ -510,7 +510,7 @@ char* get_full_path_of_avl_dir(OBIDMS_p dms, const char* avl_name)
{
char
*
avl_dir_name
;
avl_dir_name
=
get_full_path
(
dms
,
AVL_TREES
_DIR_NAME
);
avl_dir_name
=
get_full_path
(
dms
,
INDEXER
_DIR_NAME
);
if
(
avl_dir_name
==
NULL
)
{
obidebug
(
1
,
"
\n
Error getting path for the DMS AVL directory"
);
...
...
@@ -1291,7 +1291,7 @@ int obi_avl_exists(OBIDMS_p dms, const char* avl_name)
int
check_dir
;
// Build the AVL tree file path
relative_path_size
=
strlen
(
avl_name
)
+
strlen
(
AVL_TREES
_DIR_NAME
)
+
2
;
relative_path_size
=
strlen
(
avl_name
)
+
strlen
(
INDEXER
_DIR_NAME
)
+
2
;
avl_dir_relative_path
=
(
char
*
)
malloc
(
relative_path_size
*
sizeof
(
char
));
if
(
avl_dir_relative_path
==
NULL
)
{
...
...
@@ -1299,7 +1299,7 @@ int obi_avl_exists(OBIDMS_p dms, const char* avl_name)
obidebug
(
1
,
"
\n
Error allocating memory for the path to the AVL directory"
);
return
-
1
;
}
strcpy
(
avl_dir_relative_path
,
AVL_TREES
_DIR_NAME
);
strcpy
(
avl_dir_relative_path
,
INDEXER
_DIR_NAME
);
strcat
(
avl_dir_relative_path
,
"/"
);
strcat
(
avl_dir_relative_path
,
avl_name
);
avl_dir_path
=
get_full_path
(
dms
,
avl_dir_relative_path
);
...
...
@@ -1367,7 +1367,7 @@ OBIDMS_avl_p obi_create_avl(OBIDMS_p dms, const char* avl_name, int avl_idx)
// Create that AVL's directory if it doesn't already exist
if
(
check_dir
<
0
)
{
if
(
mkdirat
(
dms
->
avl
_dir_fd
,
avl_dir_name
,
00777
)
<
0
)
if
(
mkdirat
(
dms
->
indexer
_dir_fd
,
avl_dir_name
,
00777
)
<
0
)
{
obi_set_errno
(
OBI_AVL_ERROR
);
obidebug
(
1
,
"
\n
Error creating an AVL directory"
);
...
...
@@ -1596,7 +1596,7 @@ OBIDMS_avl_p obi_create_avl(OBIDMS_p dms, const char* avl_name, int avl_idx)
avl
->
dms
=
dms
;
avl
->
data
=
avl_data
;
avl
->
directory
=
dms
->
avl
_directory
;
avl
->
directory
=
dms
->
indexer
_directory
;
avl
->
dir_fd
=
avl_dir_fd
;
avl
->
avl_fd
=
avl_file_descriptor
;
...
...
@@ -1612,8 +1612,8 @@ OBIDMS_avl_p obi_create_avl(OBIDMS_p dms, const char* avl_name, int avl_idx)
bloom_init
(
&
((
avl
->
header
)
->
bloom_filter
),
MAX_NODE_COUNT_PER_AVL
);
// Add in the list of opened AVL trees
*
(((
dms
->
opened_
avls
)
->
avls
)
+
((
dms
->
opened_avls
)
->
nb_opened_avl
s
))
=
avl
;
((
dms
->
opened_
avls
)
->
nb_opened_avl
s
)
++
;
*
(((
dms
->
opened_
indexers
)
->
indexers
)
+
((
dms
->
opened_indexers
)
->
nb_opened_indexer
s
))
=
avl
;
((
dms
->
opened_
indexers
)
->
nb_opened_indexer
s
)
++
;
avl
->
counter
=
1
;
if
(
avl_idx
>=
0
)
...
...
@@ -1658,14 +1658,14 @@ OBIDMS_avl_p obi_open_avl(OBIDMS_p dms, const char* avl_name, int avl_idx)
}
// Check if the AVL tree is already in the list of opened AVL trees
for
(
i
=
0
;
i
<
((
dms
->
opened_
avls
)
->
nb_opened_avl
s
);
i
++
)
for
(
i
=
0
;
i
<
((
dms
->
opened_
indexers
)
->
nb_opened_indexer
s
);
i
++
)
{
if
(
!
strcmp
(((
*
(((
dms
->
opened_
avls
)
->
avl
s
)
+
i
))
->
header
)
->
avl_name
,
complete_avl_name
))
if
(
!
strcmp
(((
*
(((
dms
->
opened_
indexers
)
->
indexer
s
)
+
i
))
->
header
)
->
avl_name
,
complete_avl_name
))
{
// Found the AVL tree already opened
((
*
(((
dms
->
opened_
avls
)
->
avl
s
)
+
i
))
->
counter
)
++
;
((
*
(((
dms
->
opened_
indexers
)
->
indexer
s
)
+
i
))
->
counter
)
++
;
if
(
avl_idx
>=
0
)
free
(
complete_avl_name
);
return
*
(((
dms
->
opened_
avls
)
->
avl
s
)
+
i
);
return
*
(((
dms
->
opened_
indexers
)
->
indexer
s
)
+
i
);
}
}
...
...
@@ -1873,13 +1873,13 @@ OBIDMS_avl_p obi_open_avl(OBIDMS_p dms, const char* avl_name, int avl_idx)
avl
->
dms
=
dms
;
avl
->
data
=
avl_data
;
avl
->
directory
=
dms
->
avl
_directory
;
avl
->
directory
=
dms
->
indexer
_directory
;
avl
->
dir_fd
=
avl_dir_file_descriptor
;
avl
->
avl_fd
=
avl_file_descriptor
;
// Add in the list of opened AVL trees
*
(((
dms
->
opened_
avls
)
->
avls
)
+
((
dms
->
opened_avls
)
->
nb_opened_avl
s
))
=
avl
;
((
dms
->
opened_
avls
)
->
nb_opened_avl
s
)
++
;
*
(((
dms
->
opened_
indexers
)
->
indexers
)
+
((
dms
->
opened_indexers
)
->
nb_opened_indexer
s
))
=
avl
;
((
dms
->
opened_
indexers
)
->
nb_opened_indexer
s
)
++
;
avl
->
counter
=
1
;
if
(
avl_idx
>=
0
)
...
...
@@ -1983,26 +1983,26 @@ OBIDMS_avl_group_p obi_open_avl_group(OBIDMS_p dms, const char* avl_name)
int
obi_close_avl
(
OBIDMS_avl_p
avl
)
{
int
ret_val
=
0
;
size_t
i
;
Opened_
avls_list_p
avl
s_list
;
OBIDMS_p
dms
;
int
ret_val
=
0
;
size_t
i
;
Opened_
indexers_list_p
indexer
s_list
;
OBIDMS_p
dms
;
dms
=
avl
->
dms
;
avls_list
=
dms
->
opened_avl
s
;
indexers_list
=
dms
->
opened_indexer
s
;
(
avl
->
counter
)
--
;
if
(
avl
->
counter
==
0
)
{
// Delete from the list of opened avls
for
(
i
=
0
;
i
<
(
avls_list
->
nb_opened_avl
s
);
i
++
)
for
(
i
=
0
;
i
<
(
indexers_list
->
nb_opened_indexer
s
);
i
++
)
{
if
(
!
strcmp
(((
*
((
avls_list
->
avl
s
)
+
i
))
->
header
)
->
avl_name
,
(
avl
->
header
)
->
avl_name
))
if
(
!
strcmp
(((
*
((
indexers_list
->
indexer
s
)
+
i
))
->
header
)
->
avl_name
,
(
avl
->
header
)
->
avl_name
))
{
// Found the avl. Rearrange list
(
avls_list
->
nb_opened_avl
s
)
--
;
(
avls_list
->
avls
)[
i
]
=
(
avls_list
->
avls
)[
avls_list
->
nb_opened_avl
s
];
(
indexers_list
->
nb_opened_indexer
s
)
--
;
(
indexers_list
->
indexers
)[
i
]
=
(
indexers_list
->
indexers
)[
indexers_list
->
nb_opened_indexer
s
];
}
}
...
...
src/obiavl.h
View file @
d8107533
...
...
@@ -127,6 +127,7 @@ typedef struct OBIDMS_avl_header {
/**
* @brief OBIDMS AVL tree structure.
* TODO doc
*/
typedef
struct
OBIDMS_avl
{
OBIDMS_p
dms
;
/**< A pointer to the OBIDMS structure to which the AVL tree belongs.
...
...
src/obiblob_indexer.c
0 → 100644
View file @
d8107533
/****************************************************************************
* Obiblob functions *
****************************************************************************/
/**
* @file obiblob_indexer.c
* @author Celine Mercier
* @date April 12th 2016
* @brief Functions handling the indexing and retrieval of blob structures.
*/
#include <stdlib.h>
#include <stdio.h>
#include "obiblob_indexer.h"
#include "obidms.h"
#include "obiavl.h"
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
inline
int
obi_indexer_exists
(
OBIDMS_p
dms
,
const
char
*
name
);
inline
Obi_indexer_p
obi_indexer
(
OBIDMS_p
dms
,
const
char
*
name
);
inline
Obi_indexer_p
obi_create_indexer
(
OBIDMS_p
dms
,
const
char
*
name
);
inline
Obi_indexer_p
obi_open_indexer
(
OBIDMS_p
dms
,
const
char
*
name
);
inline
int
obi_close_indexer
(
Obi_indexer_p
indexer
);
inline
index_t
obi_indexer_add
(
Obi_indexer_p
indexer
,
Obi_blob_p
value
);
inline
Obi_blob_p
obi_indexer_get
(
Obi_indexer_p
indexer
,
index_t
idx
);
src/obiblob_indexer.h
0 → 100644
View file @
d8107533
/****************************************************************************
* Blob indexer header file *
****************************************************************************/
/**
* @file obiblob_indexer.h
* @author Celine Mercier
* @date April 12th 2016
* @brief Header file for the functions handling the indexing of values.
*/
#ifndef OBIBLOB_INDEXER_H_
#define OBIBLOB_INDEXER_H_
#include <stdlib.h>
#include <stdio.h>
#include "obidms.h"
#include "obiavl.h"
#include "obitypes.h"
#include "obiblob.h"
#define INDEXER_MAX_NAME AVL_MAX_NAME
/**< Macro to refer to the maximum size of the name of an indexer structure.
*/
typedef
OBIDMS_avl_group_p
Obi_indexer_p
;
/**< Typedef to refer to the used indexer structure.
*/
// TODO doc
inline
int
obi_indexer_exists
(
OBIDMS_p
dms
,
const
char
*
name
)
{
return
obi_avl_exists
(
dms
,
name
);
}
inline
Obi_indexer_p
obi_indexer
(
OBIDMS_p
dms
,
const
char
*
name
)
{
return
obi_avl_group
(
dms
,
name
);
}
inline
Obi_indexer_p
obi_create_indexer
(
OBIDMS_p
dms
,
const
char
*
name
)
{
return
obi_create_avl_group
(
dms
,
name
);
}
inline
Obi_indexer_p
obi_open_indexer
(
OBIDMS_p
dms
,
const
char
*
name
)
{
return
obi_open_avl_group
(
dms
,
name
);
}
inline
int
obi_close_indexer
(
Obi_indexer_p
indexer
)
{
return
obi_close_avl_group
(
indexer
);
}
inline
index_t
obi_indexer_add
(
Obi_indexer_p
indexer
,
Obi_blob_p
value
)
{
return
obi_avl_group_add
(
indexer
,
value
);
}
inline
Obi_blob_p
obi_indexer_get
(
Obi_indexer_p
indexer
,
index_t
idx
)
{
return
obi_avl_group_get
(
indexer
,
idx
);
}
#endif
/* OBIBLOB_INDEXER_H_ */
src/obidms.c
View file @
d8107533
...
...
@@ -249,7 +249,7 @@ OBIDMS_p obi_create_dms(const char* dms_name)
return
NULL
;
}
// Get file descriptor of DMS directory to create the
AVL trees
directory
// Get file descriptor of DMS directory to create the
indexer
directory
dms_dir
=
opendir
(
directory_name
);
if
(
dms_dir
==
NULL
)
{
...
...
@@ -269,11 +269,11 @@ OBIDMS_p obi_create_dms(const char* dms_name)
return
NULL
;
}
// Create the
AVL trees
directory
if
(
mkdirat
(
dms_file_descriptor
,
AVL_TREES
_DIR_NAME
,
00777
)
<
0
)
// Create the
indexer
directory
if
(
mkdirat
(
dms_file_descriptor
,
INDEXER
_DIR_NAME
,
00777
)
<
0
)
{
obi_set_errno
(
OBI_
AVL
_ERROR
);
obidebug
(
1
,
"
\n
Problem creating an
AVL trees
directory"
);
obi_set_errno
(
OBI_
INDEXER
_ERROR
);
obidebug
(
1
,
"
\n
Problem creating an
indexer
directory"
);
return
NULL
;
}
...
...
@@ -392,24 +392,24 @@ OBIDMS_p obi_open_dms(const char* dms_name)
dms
->
little_endian
=
little_endian_dms
;
// Open the
AVL trees
directory
dms
->
avl_directory
=
opendir_in_dms
(
dms
,
AVL_TREES
_DIR_NAME
);
if
(
dms
->
avl
_directory
==
NULL
)
// Open the
indexer
directory
dms
->
indexer_directory
=
opendir_in_dms
(
dms
,
INDEXER
_DIR_NAME
);
if
(
dms
->
indexer
_directory
==
NULL
)
{
obi_set_errno
(
OBIDMS_UNKNOWN_ERROR
);
obidebug
(
1
,
"
\n
Error opening the
AVL trees
directory"
);
obidebug
(
1
,
"
\n
Error opening the
indexer
directory"
);
closedir
(
dms
->
directory
);
free
(
dms
);
return
NULL
;
}
// Store the
AVL trees
directory's file descriptor
dms
->
avl_dir_fd
=
dirfd
(
dms
->
avl
_directory
);
if
(
dms
->
avl
_dir_fd
<
0
)
// Store the
indexer
directory's file descriptor
dms
->
indexer_dir_fd
=
dirfd
(
dms
->
indexer
_directory
);
if
(
dms
->
indexer
_dir_fd
<
0
)
{
obi_set_errno
(
OBIDMS_UNKNOWN_ERROR
);
obidebug
(
1
,
"
\n
Error getting the file descriptor of the
AVL trees
directory"
);
closedir
(
dms
->
avl
_directory
);
obidebug
(
1
,
"
\n
Error getting the file descriptor of the
indexer
directory"
);
closedir
(
dms
->
indexer
_directory
);
closedir
(
dms
->
directory
);
free
(
dms
);
return
NULL
;
...
...
@@ -420,10 +420,10 @@ OBIDMS_p obi_open_dms(const char* dms_name)
(
dms
->
opened_columns
)
->
columns
=
(
OBIDMS_column_p
*
)
malloc
(
MAX_NB_OPENED_COLUMNS
*
sizeof
(
OBIDMS_column_p
));
(
dms
->
opened_columns
)
->
nb_opened_columns
=
0
;
// Initialize the list of opened
AVL trees
dms
->
opened_
avls
=
(
Opened_avls_list_p
)
malloc
(
sizeof
(
Opened_avl
s_list_t
));
(
dms
->
opened_
avls
)
->
avls
=
(
OBIDMS_avl_p
*
)
malloc
(
MAX_NB_OPENED_AVL_TREES
*
sizeof
(
OBIDMS_avl_p
));
(
dms
->
opened_
avls
)
->
nb_opened_avl
s
=
0
;
// Initialize the list of opened
indexers // TODO should be handled somewhere else?
dms
->
opened_
indexers
=
(
Opened_indexers_list_p
)
malloc
(
sizeof
(
Opened_indexer
s_list_t
));
(
dms
->
opened_
indexers
)
->
indexers
=
(
OBIDMS_avl_p
*
)
malloc
(
MAX_NB_OPENED_INDEXERS
*
sizeof
(
OBIDMS_avl_p
));
// TODO idk how to handle this
(
dms
->
opened_
indexers
)
->
nb_opened_indexer
s
=
0
;
return
dms
;
}
...
...
@@ -456,7 +456,7 @@ int obi_close_dms(OBIDMS_p dms)
while
((
dms
->
opened_columns
)
->
nb_opened_columns
>
0
)
obi_close_column
(
*
((
dms
->
opened_columns
)
->
columns
));
// Close dms and
AVL trees
directories
// Close dms and
indexer
directories
if
(
closedir
(
dms
->
directory
)
<
0
)
{
obi_set_errno
(
OBIDMS_MEMORY_ERROR
);
...
...
@@ -464,10 +464,10 @@ int obi_close_dms(OBIDMS_p dms)
free
(
dms
);
return
-
1
;
}
if
(
closedir
(
dms
->
avl_directory
)
<
0
)
if
(
closedir
(
dms
->
indexer_directory
)
<
0
)
// TODO should be handled somewhere else?
{
obi_set_errno
(
OBI_
AVL
_ERROR
);
obidebug
(
1
,
"
\n
Error closing an
AVL trees
directory"
);
obi_set_errno
(
OBI_
INDEXER
_ERROR
);
obidebug
(
1
,
"
\n
Error closing an
indexer
directory"
);
free
(
dms
);
return
-
1
;
}
...
...
src/obidms.h
View file @
d8107533
...
...
@@ -25,16 +25,16 @@
#include "obierrno.h"
#define OBIDMS_MAX_NAME (2048)
/**< The maximum length of an OBIDMS name.
*/
#define
AVL_TREES_DIR_NAME "AVL_trees"
/**< The name of the AVL trees
directory.
*/
#define TAXONOMY_DIR_NAME "TAXONOMY"
/**< The name of the taxonomy directory.
*/
#define MAX_NB_OPENED_COLUMNS (100)
/**< The maximum number of columns open at the same time.
*/
#define MAX_NB_OPENED_
AVL_TREES (1000)
/**< The maximum number of AVL tree
s open at the same time.
*/
#define OBIDMS_MAX_NAME (2048)
/**< The maximum length of an OBIDMS name.
*/
#define
INDEXER_DIR_NAME "OBIBLOB_INDEXERS"
/**< The name of the Obiblob indexer
directory.
*/
#define TAXONOMY_DIR_NAME "TAXONOMY"
/**< The name of the taxonomy directory.
*/
#define MAX_NB_OPENED_COLUMNS (100)
/**< The maximum number of columns open at the same time.
*/
#define MAX_NB_OPENED_
INDEXERS (1000)
/**< The maximum number of indexer
s open at the same time.
*/
struct
OBIDMS_column
;
// TODO
...
...
@@ -47,10 +47,10 @@ typedef struct Opened_columns_list {
struct
OBIDMS_avl
;
// TODO
typedef
struct
Opened_
avl
s_list
{
size_t
nb_opened_
avl
s
;
struct
OBIDMS_avl
**
avls
;
}
Opened_
avls_list_t
,
*
Opened_avl
s_list_p
;
typedef
struct
Opened_
indexer
s_list
{
size_t
nb_opened_
indexer
s
;
struct
OBIDMS_avl
**
indexers
;
// TODO indexer but not AVL_group
}
Opened_
indexers_list_t
,
*
Opened_indexer
s_list_p
;
/**
...
...
@@ -69,17 +69,17 @@ typedef struct OBIDMS {
int
dir_fd
;
/**< The file descriptor of the directory entry
* usable to refer and scan the database directory.
*/
DIR
*
avl
_directory
;
/**< A directory entry usable to
* refer and scan the
AVL trees
directory.
DIR
*
indexer
_directory
;
/**< A directory entry usable to
* refer and scan the
indexer
directory.
*/
int
avl
_dir_fd
;
/**< The file descriptor of the directory entry
* usable to refer and scan the
AVL trees
directory.
int
indexer
_dir_fd
;
/**< The file descriptor of the directory entry
* usable to refer and scan the
indexer
directory.
*/
bool
little_endian
;
/**< Endianness of the database.
*/
Opened_columns_list_p
opened_columns
;
/**< List of opened columns.
*/
Opened_
avls_list_p
opened_avls
;
/**< List of opened AVL tree
s.
Opened_
indexers_list_p
opened_indexers
;
/**< List of opened indexer
s.
*/
}
OBIDMS_t
,
*
OBIDMS_p
;
...
...
@@ -107,7 +107,7 @@ int obi_dms_exists(const char* dms_name);
* if a directory with this name does not already exist
* before creating the new database.
*
* A directory to store
AVL tree
s is also created.
* A directory to store
Obiblob indexer
s is also created.
*
* @param dms_name A pointer to a C string containing the name of the database.
* The actual directory name used to store the DMS will be
...
...
src/obidmscolumn.c
View file @
d8107533
...
...
@@ -29,7 +29,7 @@
#include "obierrno.h"
#include "obidebug.h"
#include "obilittlebigman.h"
#include "obi
avl
.h"
#include "obi
blob_indexer
.h"
#include "utils.h"
...
...
@@ -519,7 +519,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
index_t
nb_lines
,
index_t
nb_elements_per_line
,
const
char
*
elements_names
,
const
char
*
avl
_name
,
const
char
*
indexer
_name
,
const
char
*
comments
)
{
...
...
@@ -554,9 +554,9 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
obidebug
(
1
,
"
\n
Can't create column because of invalid data type"
);
return
NULL
;
}
if
(((
data_type
==
OBI_STR
)
||
(
data_type
==
OBI_SEQ
))
&&
(
avl
_name
==
NULL
))
if
(((
data_type
==
OBI_STR
)
||
(
data_type
==
OBI_SEQ
))
&&
(
indexer
_name
==
NULL
))
{
obidebug
(
1
,
"
\n
Can't create column because of empty
avl
name"
);
obidebug
(
1
,
"
\n
Can't create column because of empty
indexer
name"
);
return
NULL
;
}
...
...
@@ -724,19 +724,19 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
if
(
comments
!=
NULL
)
strncpy
(
header
->
comments
,
comments
,
COMMENTS_MAX_LENGTH
);
// If the data type is OBI_STR or OBI_SEQ, the associated obi_
avl
is opened or created
// If the data type is OBI_STR or OBI_SEQ, the associated obi_
indexer
is opened or created
if
((
returned_data_type
==
OBI_STR
)
||
(
returned_data_type
==
OBI_SEQ
))
{
new_column
->
avl
=
obi_avl_group
(
dms
,
avl
_name
);
if
(
new_column
->
avl
==
NULL
)
new_column
->
indexer
=
obi_indexer
(
dms
,
indexer
_name
);
if
(
new_column
->
indexer
==
NULL
)
{
obidebug
(
1
,
"
\n
Error opening or creating the
AVL group
associated with a column"
);
obidebug
(
1
,
"
\n
Error opening or creating the
indexer
associated with a column"
);
munmap
(
new_column
->
header
,
header_size
);
close
(
column_file_descriptor
);
free
(
new_column
);
return
NULL
;
}
strncpy
(
header
->
avl_name
,
avl_name
,
AVL
_MAX_NAME
);
strncpy
(
header
->
indexer_name
,
indexer_name
,
INDEXER
_MAX_NAME
);
}
// Fill the data with NA values
...
...
@@ -876,13 +876,13 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
column
->
writable
=
false
;
// If the data type is OBI_STR or OBI_SEQ, the associated
AVL tree
is opened
// If the data type is OBI_STR or OBI_SEQ, the associated
indexer
is opened
if
(((
column
->
header
)
->
returned_data_type
==
OBI_STR
)
||
((
column
->
header
)
->
returned_data_type
==
OBI_SEQ
))
{
column
->
avl
=
obi_open_avl_group
(
dms
,
(
column
->
header
)
->
avl
_name
);
if
(
column
->
avl
==
NULL
)
column
->
indexer
=
obi_open_indexer
(
dms
,
(
column
->
header
)
->
indexer
_name
);
if
(
column
->
indexer
==
NULL
)
{
obidebug
(
1
,
"
\n
Error opening the
AVL tree
associated with a column"
);
obidebug
(
1
,
"
\n
Error opening the
indexer
associated with a column"
);
munmap
(
column
->
header
,
header_size
);
close
(
column_file_descriptor
);
free
(
column
);
...
...
@@ -940,7 +940,7 @@ OBIDMS_column_p obi_clone_column(OBIDMS_p dms,
nb_lines
,
nb_elements_per_line
,
(
column_to_clone
->
header
)
->
elements_names
,
(
column_to_clone
->
header
)
->
avl
_name
,
(
column_to_clone
->
header
)
->
indexer
_name
,
(
column_to_clone
->
header
)
->
comments
);
...
...
@@ -1016,10 +1016,10 @@ int obi_close_column(OBIDMS_column_p column)
}
}
// If the data type is OBI_STR or OBI_SEQ, the associated
AVL group
is closed
// If the data type is OBI_STR or OBI_SEQ, the associated
indexer
is closed
if
(((
column
->
header
)
->
returned_data_type
==
OBI_STR
)
||
((
column
->
header
)
->
returned_data_type
==
OBI_SEQ
))
{
if
(
obi_close_
avl_group
(
column
->
avl
)
<
0
)
if
(
obi_close_
indexer
(
column
->
indexer
)
<
0
)
return
-
1
;
}
...
...
src/obidmscolumn.h
View file @
d8107533
...
...
@@ -25,7 +25,7 @@
#include "obierrno.h"
#include "obilittlebigman.h"
#include "obidmscolumndir.h"
#include "obi
avl
.h"
#include "obi
blob_indexer
.h"
#define ELEMENTS_NAMES_MAX (2048)
/**< The maximum length of the list of elements names.
...
...
@@ -76,7 +76,7 @@ typedef struct OBIDMS_column_header {
*/
char
name
[
OBIDMS_COLUMN_MAX_NAME
+
1
];
/**< The column name as a NULL terminated string.
*/
char
avl_name
[
AVL_MAX_NAME
+
1
];
/**< If there is one, the AVL tree
name as a NULL terminated string.
char
indexer_name
[
INDEXER_MAX_NAME
+
1
];
/**< If there is one, the indexer
name as a NULL terminated string.
*/
char
comments
[
COMMENTS_MAX_LENGTH
+
1
];
/**< Comments stored as a classical zero end C string.
*/
...
...
@@ -96,7 +96,7 @@ typedef struct OBIDMS_column {
*/
OBIDMS_column_header_p
header
;
/**< A pointer to the header of the column.
*/
O
BIDMS_avl_group_p
avl
;
/**< TODO A pointer to the group of AVL trees
associated with the column if there is one.
O
bi_indexer_p
indexer
;
/**< A pointer to the blob indexer
associated with the column if there is one.
*/
void
*
data
;
/**< A `void` pointer to the beginning of the data.
*
...
...
@@ -162,7 +162,7 @@ size_t obi_get_platform_header_size();
* @brief Creates a column.
*
* The minimum data size allocated is one memory page, and the data is initialized to the NA value of the OBIType.
* If there is an
AVL tree
associated with the column, it is opened or created if it does not already exist.
* If there is an
indexer
associated with the column, it is opened or created if it does not already exist.
*
* @warning If there is one element per line, elements_names should be equal to column_name. // TODO change this condition?
*
...
...
@@ -172,7 +172,7 @@ size_t obi_get_platform_header_size();
* @param nb_lines The number of lines to be stored.
* @param nb_elements_per_line The number of elements per line. // TODO talk about default values
* @param elements_names The names of the elements with ';' as separator.
* @param
avl_name The name of the AVL tree
if there is one associated with the column.
* @param
indexer_name The name of the indexer
if there is one associated with the column.