|
@@ -1,5 +1,3 @@
|
|
|
-#include <ftw.h>
|
|
|
-
|
|
|
#include "store_mdb.h"
|
|
|
|
|
|
/**
|
|
@@ -11,12 +9,12 @@
|
|
|
* Memory map size.
|
|
|
*/
|
|
|
#if (defined DEBUG || defined TESTING)
|
|
|
- #define DEFAULT_MAPSIZE 1<<24 // 16Mb (limit for Valgrind)
|
|
|
+#define DEFAULT_MAPSIZE 1<<24 // 16Mb (limit for Valgrind)
|
|
|
#elif !(defined __LP64__ || defined __LLP64__) || \
|
|
|
defined _WIN32 && !defined _WIN64
|
|
|
- #define DEFAULT_MAPSIZE 1<<31 // 2Gb (limit for 32-bit systems)
|
|
|
+#define DEFAULT_MAPSIZE 1<<31 // 2Gb (limit for 32-bit systems)
|
|
|
#else
|
|
|
- #define DEFAULT_MAPSIZE 1UL<<40 // 1Tb
|
|
|
+#define DEFAULT_MAPSIZE 1UL<<40 // 1Tb
|
|
|
#endif
|
|
|
|
|
|
#define ENV_DIR_MODE 0750
|
|
@@ -201,7 +199,7 @@ inline static LSUP_rc lookup_3bound(MDBIterator *it, size_t *ct);
|
|
|
* Store interface.
|
|
|
*/
|
|
|
|
|
|
-LSUP_NSMap *
|
|
|
+static LSUP_NSMap *
|
|
|
mdbstore_nsm_get (void *h)
|
|
|
{
|
|
|
MDBStore *store = h;
|
|
@@ -241,7 +239,7 @@ finally:
|
|
|
}
|
|
|
|
|
|
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_nsm_put (void *h, const LSUP_NSMap *nsm)
|
|
|
{
|
|
|
MDBStore *store = h;
|
|
@@ -332,7 +330,7 @@ mdbstore_path_from_id (const char *id)
|
|
|
* and checking that it's a writable directory. If the path is not specified
|
|
|
* in the LSUP_MDB_STORE_URN environment variable, a default directory is used.
|
|
|
*/
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_setup (const char *id, bool clear)
|
|
|
{
|
|
|
const char *path = mdbstore_path_from_id (id);
|
|
@@ -380,7 +378,7 @@ mdbstore_setup (const char *id, bool clear)
|
|
|
* it is not necessary to modify this, unless one is operating under memory
|
|
|
* and disk constraints. The default map size is 1Tb.
|
|
|
*/
|
|
|
-void *
|
|
|
+static void *
|
|
|
mdbstore_new (const char *id, size_t _unused)
|
|
|
{
|
|
|
(void) _unused;
|
|
@@ -436,7 +434,7 @@ fail:
|
|
|
}
|
|
|
|
|
|
|
|
|
-void
|
|
|
+static void
|
|
|
mdbstore_free (void *h)
|
|
|
{
|
|
|
MDBStore *store = h;
|
|
@@ -451,7 +449,8 @@ mdbstore_free (void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
-char *mdbstore_id (const void *h)
|
|
|
+static char *
|
|
|
+mdbstore_id (const void *h)
|
|
|
{
|
|
|
const MDBStore *store = h;
|
|
|
const char *path;
|
|
@@ -461,7 +460,7 @@ char *mdbstore_id (const void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_stat (const MDBStore *store, MDB_stat *stat)
|
|
|
{
|
|
|
if (!(store->state & LSSTORE_OPEN)) return 0;
|
|
@@ -477,7 +476,7 @@ mdbstore_stat (const MDBStore *store, MDB_stat *stat)
|
|
|
}
|
|
|
|
|
|
|
|
|
-size_t
|
|
|
+static size_t
|
|
|
mdbstore_size (const void *h)
|
|
|
{
|
|
|
const MDBStore *store = h;
|
|
@@ -490,7 +489,7 @@ mdbstore_size (const void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void *
|
|
|
+static void *
|
|
|
mdbstore_add_init (void *h, const LSUP_Buffer *sc)
|
|
|
{
|
|
|
MDBStore *store = h;
|
|
@@ -544,7 +543,7 @@ mdbstore_add_init (void *h, const LSUP_Buffer *sc)
|
|
|
* #mdbstore_add_abort or #mdbstore_add_done. FIXME
|
|
|
*
|
|
|
*/
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_add_iter (void *h, const LSUP_BufferTriple *sspo)
|
|
|
{
|
|
|
if (UNLIKELY (!h)) return LSUP_VALUE_ERR;
|
|
@@ -603,7 +602,7 @@ mdbstore_add_iter (void *h, const LSUP_BufferTriple *sspo)
|
|
|
}
|
|
|
|
|
|
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_add_done (void *h)
|
|
|
{
|
|
|
MDBIterator *it = h;
|
|
@@ -622,7 +621,7 @@ mdbstore_add_done (void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void
|
|
|
+static void
|
|
|
mdbstore_add_abort (void *h)
|
|
|
{
|
|
|
MDBIterator *it = h;
|
|
@@ -634,8 +633,9 @@ mdbstore_add_abort (void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
+#if 0
|
|
|
/* TODO deprecate. Use low-level instead and abstract at graph level. */
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_add (
|
|
|
void *h, const LSUP_Buffer *sc,
|
|
|
const LSUP_BufferTriple strp[], const size_t ct, size_t *inserted)
|
|
@@ -655,6 +655,7 @@ mdbstore_add (
|
|
|
|
|
|
return mdbstore_add_done (it);
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
static LSUP_rc
|
|
@@ -682,7 +683,7 @@ key_to_sterm (MDBIterator *it, const LSUP_Key key, LSUP_Buffer *sterm)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void *
|
|
|
+static void *
|
|
|
mdbstore_lookup (
|
|
|
void *h, const LSUP_Buffer *ss, const LSUP_Buffer *sp,
|
|
|
const LSUP_Buffer *so, const LSUP_Buffer *sc, size_t *ct)
|
|
@@ -780,7 +781,7 @@ mdbstore_lookup (
|
|
|
* ckset is filled with an array of contexts that the triple appears
|
|
|
* in, if not NULL.
|
|
|
*/
|
|
|
-inline static LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbiter_next_key (MDBIterator *it)
|
|
|
{
|
|
|
if (UNLIKELY (!it)) return LSUP_VALUE_ERR;
|
|
@@ -872,7 +873,7 @@ mdbiter_next_key (MDBIterator *it)
|
|
|
}
|
|
|
|
|
|
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbiter_next (
|
|
|
void *h, LSUP_BufferTriple *sspo, LSUP_Buffer **ctx_p)
|
|
|
{
|
|
@@ -911,7 +912,7 @@ mdbiter_next (
|
|
|
}
|
|
|
|
|
|
|
|
|
-void
|
|
|
+static void
|
|
|
mdbiter_free (void *h)
|
|
|
{
|
|
|
MDBIterator *it = h;
|
|
@@ -926,7 +927,7 @@ mdbiter_free (void *h)
|
|
|
}
|
|
|
|
|
|
|
|
|
-LSUP_rc
|
|
|
+static LSUP_rc
|
|
|
mdbstore_remove(
|
|
|
void *h, const LSUP_Buffer *ss, const LSUP_Buffer *sp,
|
|
|
const LSUP_Buffer *so, const LSUP_Buffer *sc, size_t *ct)
|
|
@@ -1016,7 +1017,7 @@ fail:
|
|
|
}
|
|
|
|
|
|
|
|
|
-int
|
|
|
+static int
|
|
|
mdbstore_tkey_exists (MDBStore *store, LSUP_Key tkey)
|
|
|
{
|
|
|
int db_rc, rc;
|