mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-29 23:19:20 +08:00
mdbx: add mdbx_env_get_maxdbs().
Change-Id: Ie4bdd2f8a46130f277ef98861a5fca98f55bad54
This commit is contained in:
parent
9e90718bd5
commit
b91918b027
13
mdbx.h
13
mdbx.h
@ -2197,6 +2197,7 @@ LIBMDBX_API int mdbx_env_get_maxreaders(const MDBX_env *env, unsigned *readers);
|
||||
* Currently a moderate number of slots are cheap but a huge number gets
|
||||
* expensive: 7-120 words per transaction, and every \ref mdbx_dbi_open()
|
||||
* does a linear search of the opened slots.
|
||||
* \see mdbx_env_get_maxdbs()
|
||||
*
|
||||
* \param [in] env An environment handle returned by \ref mdbx_env_create().
|
||||
* \param [in] dbs The maximum number of databases.
|
||||
@ -2207,6 +2208,18 @@ LIBMDBX_API int mdbx_env_get_maxreaders(const MDBX_env *env, unsigned *readers);
|
||||
* \retval MDBX_EPERM The environment is already open. */
|
||||
LIBMDBX_API int mdbx_env_set_maxdbs(MDBX_env *env, MDBX_dbi dbs);
|
||||
|
||||
/** Get the maximum number of named databases for the environment.
|
||||
* \ingroup c_statinfo
|
||||
* \see mdbx_env_set_maxdbs()
|
||||
*
|
||||
* \param [in] env An environment handle returned by \ref mdbx_env_create().
|
||||
* \param [out] dbs Address to store the maximum number of databases.
|
||||
*
|
||||
* \returns A non-zero error value on failure and 0 on success,
|
||||
* some possible errors are:
|
||||
* \retval MDBX_EINVAL An invalid parameter was specified. */
|
||||
LIBMDBX_API int mdbx_env_get_maxdbs(MDBX_env *env, MDBX_dbi *dbs);
|
||||
|
||||
/** Get the maximum size of keys can write.
|
||||
* \ingroup c_statinfo
|
||||
*
|
||||
|
12
src/core.c
12
src/core.c
@ -9259,6 +9259,18 @@ int __cold mdbx_env_set_maxdbs(MDBX_env *env, MDBX_dbi dbs) {
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
int __cold mdbx_env_get_maxdbs(MDBX_env *env, MDBX_dbi *dbs) {
|
||||
int rc = check_env(env);
|
||||
if (unlikely(rc != MDBX_SUCCESS))
|
||||
return rc;
|
||||
|
||||
if (unlikely(!dbs))
|
||||
return MDBX_EINVAL;
|
||||
|
||||
*dbs = env->me_maxdbs;
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
int __cold mdbx_env_set_maxreaders(MDBX_env *env, unsigned readers) {
|
||||
int rc = check_env(env);
|
||||
if (unlikely(rc != MDBX_SUCCESS))
|
||||
|
Loading…
Reference in New Issue
Block a user