|
@@ -521,17 +521,6 @@ LSUP_mdbstore_add (
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/*
|
|
|
|
-static LSUP_Key
|
|
|
|
-sterm_to_key (
|
|
|
|
- LSUP_MDBStore *store, const LSUP_Buffer *sterm)
|
|
|
|
-{
|
|
|
|
- // TODO this will be replaced by a lookup when 128-bit hash is introduced.
|
|
|
|
- return LSUP_buffer_hash (sterm);
|
|
|
|
-}
|
|
|
|
-*/
|
|
|
|
-
|
|
|
|
-
|
|
|
|
static LSUP_rc
|
|
static LSUP_rc
|
|
key_to_sterm (LSUP_MDBIterator *it, const LSUP_Key key, LSUP_Buffer *sterm)
|
|
key_to_sterm (LSUP_MDBIterator *it, const LSUP_Key key, LSUP_Buffer *sterm)
|
|
{
|
|
{
|
|
@@ -894,37 +883,6 @@ fail:
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/* TODO remove deprecated function.
|
|
|
|
-LSUP_Buffer **
|
|
|
|
-LSUP_mdbstore_lookup_contexts (
|
|
|
|
- LSUP_MDBStore *store, const LSUP_Buffer *ss, const LSUP_Buffer *sp,
|
|
|
|
- const LSUP_Buffer *so)
|
|
|
|
-{
|
|
|
|
- LSUP_MDBIterator *it = LSUP_mdbstore_lookup (
|
|
|
|
- store, ss, sp, so, NULL, NULL);
|
|
|
|
-
|
|
|
|
- LSUP_rc rc = LSUP_NORESULT;
|
|
|
|
- KeySet *ckey, *tmp;
|
|
|
|
- while (rc != LSUP_END)
|
|
|
|
- rc = mdbiter_next_key (it, ckeys);
|
|
|
|
-
|
|
|
|
- size_t i = 0;
|
|
|
|
- LSUP_Buffer **ctx_a = calloc (HASH_COUNT (ckeys) + 1, sizeof (*ctx_a));
|
|
|
|
- if (UNLIKELY (!ctx_a)) return NULL;
|
|
|
|
-
|
|
|
|
- HASH_ITER (hh, ckeys, ckey, tmp) {
|
|
|
|
- ctx_a[i] = BUF_DUMMY;
|
|
|
|
- key_to_sterm (it, ckey->key, ctx_a[i++]);
|
|
|
|
- HASH_DEL (ckeys, ckey);
|
|
|
|
- free (ckey);
|
|
|
|
- }
|
|
|
|
- LSUP_mdbiter_free (it);
|
|
|
|
-
|
|
|
|
- return ctx_a;
|
|
|
|
-}
|
|
|
|
-*/
|
|
|
|
-
|
|
|
|
-
|
|
|
|
LSUP_rc
|
|
LSUP_rc
|
|
LSUP_mdbstore_nsm_get (LSUP_MDBStore *store, LSUP_NSMap **nsm_p)
|
|
LSUP_mdbstore_nsm_get (LSUP_MDBStore *store, LSUP_NSMap **nsm_p)
|
|
{
|
|
{
|
|
@@ -1100,49 +1058,6 @@ fail:
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/*
|
|
|
|
-LSUP_rc
|
|
|
|
-LSUP_mdbstore_tcache_get (LSUP_MDBStore *store)
|
|
|
|
-{
|
|
|
|
- int db_rc, rc = LSUP_NOACTION;
|
|
|
|
- MDB_txn *txn = NULL;
|
|
|
|
- MDB_cursor *cur = NULL;
|
|
|
|
-
|
|
|
|
- RCCK (mdb_txn_begin (store->env, NULL, MDB_RDONLY, &txn));
|
|
|
|
-
|
|
|
|
- db_rc = mdb_cursor_open (txn, store->dbi[IDX_IDK_ID], &cur);
|
|
|
|
- if (UNLIKELY (db_rc != MDB_SUCCESS)) {
|
|
|
|
- log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
|
|
- rc = LSUP_DB_ERR;
|
|
|
|
- goto finally;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- MDB_val key, data;
|
|
|
|
- db_rc = mdb_cursor_get (cur, &key, &data, MDB_FIRST);
|
|
|
|
- if (db_rc != MDB_NOTFOUND) rc = LSUP_OK;
|
|
|
|
-
|
|
|
|
- while (db_rc == MDB_SUCCESS) {
|
|
|
|
- rc = LSUP_tcache_add_id (
|
|
|
|
- *(uint32_t *) key.mv_data, (char *) data.mv_data);
|
|
|
|
- if (UNLIKELY (rc != LSUP_OK)) goto finally;
|
|
|
|
-
|
|
|
|
- db_rc = mdb_cursor_get (cur, &key, &data, MDB_NEXT_NODUP);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (db_rc != MDB_NOTFOUND) {
|
|
|
|
- log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
|
|
- rc = LSUP_DB_ERR;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-finally:
|
|
|
|
- if (cur) mdb_cursor_close (cur);
|
|
|
|
- mdb_txn_abort (txn);
|
|
|
|
-
|
|
|
|
- return rc;
|
|
|
|
-}
|
|
|
|
-*/
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/* * * Static functions. * * */
|
|
/* * * Static functions. * * */
|
|
|
|
|
|
|
|
|