mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:24:13 +08:00
mdbx: drop MDB_rel_func and related.
This commit is contained in:
parent
a034502657
commit
d2d8403f45
32
mdbx.c
32
mdbx.c
@ -930,8 +930,6 @@ typedef struct MDB_dbx {
|
||||
MDB_val md_name; /**< name of the database */
|
||||
MDB_cmp_func *md_cmp; /**< function for comparing keys */
|
||||
MDB_cmp_func *md_dcmp; /**< function for comparing data items */
|
||||
MDB_rel_func *md_rel; /**< user relocate function */
|
||||
void *md_relctx; /**< user-provided context for md_rel */
|
||||
} MDB_dbx;
|
||||
|
||||
#if MDBX_MODE_ENABLED
|
||||
@ -7723,7 +7721,6 @@ static void mdbx_xcursor_init0(MDB_cursor *mc) {
|
||||
mx->mx_dbx.md_name.mv_data = NULL;
|
||||
mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp;
|
||||
mx->mx_dbx.md_dcmp = NULL;
|
||||
mx->mx_dbx.md_rel = mc->mc_dbx->md_rel;
|
||||
}
|
||||
|
||||
/** Final setup of a sorted-dups cursor.
|
||||
@ -10102,7 +10099,6 @@ int mdbx_dbi_open(MDB_txn *txn, const char *name, unsigned flags,
|
||||
unsigned slot = unused ? unused : txn->mt_numdbs;
|
||||
txn->mt_dbxs[slot].md_name.mv_data = namedup;
|
||||
txn->mt_dbxs[slot].md_name.mv_size = len;
|
||||
txn->mt_dbxs[slot].md_rel = NULL;
|
||||
txn->mt_dbflags[slot] = dbflag;
|
||||
/* txn-> and env-> are the same in read txns, use
|
||||
* tmp variable to avoid undefined assignment
|
||||
@ -10354,34 +10350,6 @@ int mdbx_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp) {
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
int mdbx_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel) {
|
||||
if (unlikely(!txn))
|
||||
return EINVAL;
|
||||
|
||||
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||
return MDB_VERSION_MISMATCH;
|
||||
|
||||
if (unlikely(!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)))
|
||||
return EINVAL;
|
||||
|
||||
txn->mt_dbxs[dbi].md_rel = rel;
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
int mdbx_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx) {
|
||||
if (unlikely(!txn))
|
||||
return EINVAL;
|
||||
|
||||
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||
return MDB_VERSION_MISMATCH;
|
||||
|
||||
if (unlikely(!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)))
|
||||
return EINVAL;
|
||||
|
||||
txn->mt_dbxs[dbi].md_relctx = ctx;
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
int __cold mdbx_env_get_maxkeysize(MDB_env *env) {
|
||||
if (!env || env->me_signature != MDBX_ME_SIGNATURE)
|
||||
return EINVAL;
|
||||
|
57
mdbx.h
57
mdbx.h
@ -117,25 +117,6 @@ typedef struct iovec MDB_val;
|
||||
/** @brief A callback function used to compare two keys in a database */
|
||||
typedef int(MDB_cmp_func)(const MDB_val *a, const MDB_val *b);
|
||||
|
||||
/** @brief A callback function used to relocate a position-dependent data item
|
||||
* in a fixed-address database.
|
||||
*
|
||||
* The \b newptr gives the item's desired address in
|
||||
* the memory map, and \b oldptr gives its previous address. The item's actual
|
||||
* data resides at the address in \b item. This callback is expected to walk
|
||||
* through the fields of the record in \b item and modify any
|
||||
* values based at the \b oldptr address to be relative to the \b newptr
|
||||
* address.
|
||||
* @param[in,out] item The item that is to be relocated.
|
||||
* @param[in] oldptr The previous address.
|
||||
* @param[in] newptr The new address to relocate to.
|
||||
* @param[in] relctx An application-provided context, set by
|
||||
* #mdbx_set_relctx().
|
||||
* @todo This feature is currently unimplemented.
|
||||
*/
|
||||
typedef void(MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr,
|
||||
void *relctx);
|
||||
|
||||
/** @defgroup mdbx_env Environment Flags
|
||||
* @{
|
||||
*/
|
||||
@ -1243,44 +1224,6 @@ int mdbx_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
|
||||
*/
|
||||
int mdbx_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
|
||||
|
||||
/** @brief Set a relocation function for a #MDB_FIXEDMAP database.
|
||||
*
|
||||
* @todo The relocation function is called whenever it is necessary to move
|
||||
*the data
|
||||
* of an item to a different position in the database (e.g. through tree
|
||||
* balancing operations, shifts as a result of adds or deletes, etc.). It is
|
||||
* intended to allow address/position-dependent data items to be stored in
|
||||
* a database in an environment opened with the #MDB_FIXEDMAP option.
|
||||
* Currently the relocation feature is unimplemented and setting
|
||||
* this function has no effect.
|
||||
* @param[in] txn A transaction handle returned by #mdbx_txn_begin()
|
||||
* @param[in] dbi A database handle returned by #mdbx_dbi_open()
|
||||
* @param[in] rel A #MDB_rel_func function
|
||||
* @return A non-zero error value on failure and 0 on success. Some possible
|
||||
* errors are:
|
||||
* <ul>
|
||||
* <li>EINVAL - an invalid parameter was specified.
|
||||
* </ul>
|
||||
*/
|
||||
int mdbx_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel);
|
||||
|
||||
/** @brief Set a context pointer for a #MDB_FIXEDMAP database's relocation
|
||||
*function.
|
||||
*
|
||||
* See #mdbx_set_relfunc and #MDB_rel_func for more details.
|
||||
* @param[in] txn A transaction handle returned by #mdbx_txn_begin()
|
||||
* @param[in] dbi A database handle returned by #mdbx_dbi_open()
|
||||
* @param[in] ctx An arbitrary pointer for whatever the application needs.
|
||||
* It will be passed to the callback function set by #mdbx_set_relfunc
|
||||
* as its \b relctx parameter whenever the callback is invoked.
|
||||
* @return A non-zero error value on failure and 0 on success. Some possible
|
||||
* errors are:
|
||||
* <ul>
|
||||
* <li>EINVAL - an invalid parameter was specified.
|
||||
* </ul>
|
||||
*/
|
||||
int mdbx_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx);
|
||||
|
||||
/** @brief Get items from a database.
|
||||
*
|
||||
* This function retrieves key/data pairs from the database. The address
|
||||
|
Loading…
x
Reference in New Issue
Block a user