mdbx: deprecate mdbx_dbi_open_ex() and custom comparators.

Change-Id: I1d20f77b9ba5d8d5ec891df17019377afb466b06
This commit is contained in:
Leonid Yuriev 2020-07-07 19:33:59 +03:00
parent fab6ddee14
commit e989cb05ed
3 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,5 @@
## v0.9.x (in the development):
- Since v0.9 usage of custom comparators and the `mdbx_dbi_open_ex()` are deprecated.
- TODO: API for explicit threads (de)registration.
- TODO: Native bindings for C++.
- TODO: Packages for AltLinux, Fedora/RHEL, Debian/Ubuntu.

6
mdbx.h
View File

@ -2678,9 +2678,9 @@ typedef int(MDBX_cmp_func)(const MDBX_val *a, const MDBX_val *b);
* i.e. the passed flags is different with which the
* database was created, or the database was already
* opened with a different comparison function(s). */
LIBMDBX_API int mdbx_dbi_open_ex(MDBX_txn *txn, const char *name,
unsigned flags, MDBX_dbi *dbi,
MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
MDBX_DEPRECATED LIBMDBX_API int
mdbx_dbi_open_ex(MDBX_txn *txn, const char *name, unsigned flags, MDBX_dbi *dbi,
MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name, unsigned flags,
MDBX_dbi *dbi);

View File

@ -16452,9 +16452,9 @@ static int mdbx_dbi_bind(MDBX_txn *txn, const MDBX_dbi dbi, unsigned user_flags,
return MDBX_SUCCESS;
}
int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name, unsigned user_flags,
MDBX_dbi *dbi, MDBX_cmp_func *keycmp,
MDBX_cmp_func *datacmp) {
static int dbi_open(MDBX_txn *txn, const char *table_name, unsigned user_flags,
MDBX_dbi *dbi, MDBX_cmp_func *keycmp,
MDBX_cmp_func *datacmp) {
int rc = MDBX_EINVAL;
if (unlikely(!dbi))
return rc;
@ -16673,7 +16673,13 @@ int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name, unsigned user_flags,
int mdbx_dbi_open(MDBX_txn *txn, const char *table_name, unsigned table_flags,
MDBX_dbi *dbi) {
return mdbx_dbi_open_ex(txn, table_name, table_flags, dbi, nullptr, nullptr);
return dbi_open(txn, table_name, table_flags, dbi, nullptr, nullptr);
}
int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name,
unsigned table_flags, MDBX_dbi *dbi, MDBX_cmp_func *keycmp,
MDBX_cmp_func *datacmp) {
return dbi_open(txn, table_name, table_flags, dbi, keycmp, datacmp);
}
int __cold mdbx_dbi_stat(MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *dest,