mdbx: rename mdbx_stat() to mdbx_dbi_stat().

This commit is contained in:
Leo Yuriev 2017-03-29 18:51:22 +03:00
parent 40f8f53b0e
commit 7d351f74c4
8 changed files with 20 additions and 17 deletions

6
mdbx.h
View File

@ -421,7 +421,7 @@ typedef enum MDB_cursor_op {
/* Statistics for a database in the environment */
typedef struct MDBX_stat {
unsigned ms_psize; /* Size of a database page.
This is currently the
This is currently the
same for all databases. */
unsigned ms_depth; /* Depth (height) of the B-tree */
size_t ms_branch_pages; /* Number of internal (non-leaf) pages */
@ -1184,8 +1184,8 @@ LIBMDBX_API int mdbx_dbi_open(MDB_txn *txn, const char *name, unsigned flags,
* errors are:
* - EINVAL - an invalid parameter was specified.
*/
LIBMDBX_API int mdbx_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *stat,
size_t bytes);
LIBMDBX_API int mdbx_dbi_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *stat,
size_t bytes);
/* Retrieve the DB flags for a database handle.
*

View File

@ -8700,7 +8700,7 @@ int __cold mdbx_env_get_fd(MDB_env *env, mdbx_filehandle_t *arg) {
return MDB_SUCCESS;
}
/** Common code for #mdbx_stat() and #mdbx_env_stat().
/** Common code for #mdbx_dbi_stat() and #mdbx_env_stat().
* @param[in] env the environment to operate in.
* @param[in] db the #MDB_db record containing the stats to return.
* @param[out] arg the address of an #MDB_stat structure to receive the stats.
@ -8925,7 +8925,8 @@ int mdbx_dbi_open(MDB_txn *txn, const char *name, unsigned flags,
return rc;
}
int __cold mdbx_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *arg, size_t bytes) {
int __cold mdbx_dbi_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *arg,
size_t bytes) {
if (unlikely(!arg || !txn))
return EINVAL;

View File

@ -442,9 +442,9 @@ static int process_db(MDB_dbi dbi, char *name, visitor *handler, int silent) {
return rc;
}
rc = mdbx_stat(txn, dbi, &ms, sizeof(ms));
rc = mdbx_dbi_stat(txn, dbi, &ms, sizeof(ms));
if (rc) {
error(" - mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc));
error(" - mdbx_dbi_stat failed, error %d %s\n", rc, mdbx_strerror(rc));
return rc;
}

View File

@ -96,7 +96,7 @@ static int dumpit(MDB_txn *txn, MDB_dbi dbi, char *name) {
if (rc)
return rc;
rc = mdbx_stat(txn, dbi, &ms, sizeof(ms));
rc = mdbx_dbi_stat(txn, dbi, &ms, sizeof(ms));
if (rc)
return rc;

View File

@ -170,9 +170,10 @@ int main(int argc, char *argv[]) {
mdbx_strerror(rc));
goto txn_abort;
}
rc = mdbx_stat(txn, dbi, &mst, sizeof(mst));
rc = mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst));
if (rc) {
fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc));
fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc,
mdbx_strerror(rc));
goto txn_abort;
}
prstat(&mst);
@ -248,9 +249,10 @@ int main(int argc, char *argv[]) {
goto txn_abort;
}
rc = mdbx_stat(txn, dbi, &mst, sizeof(mst));
rc = mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst));
if (rc) {
fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc));
fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc,
mdbx_strerror(rc));
goto txn_abort;
}
printf("Status of %s\n", subname ? subname : "Main DB");
@ -280,9 +282,9 @@ int main(int argc, char *argv[]) {
free(str);
if (rc)
continue;
rc = mdbx_stat(txn, db2, &mst, sizeof(mst));
rc = mdbx_dbi_stat(txn, db2, &mst, sizeof(mst));
if (rc) {
fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc,
fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc,
mdbx_strerror(rc));
goto txn_abort;
}

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
E(mdbx_drop(txn, dbi, 1));
E(mdbx_dbi_open(txn, "id6", MDB_CREATE | MDB_INTEGERKEY, &dbi));
E(mdbx_cursor_open(txn, dbi, &cursor));
E(mdbx_stat(txn, dbi, &mst, sizeof(mst)));
E(mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst)));
sval = calloc(1, mst.ms_psize / 4);
key.mv_size = sizeof(long);

View File

@ -203,7 +203,7 @@ static void get_db_stat(const char *db, int64_t *ms_branch_pages,
LMDB_CHECK(mdbx_txn_begin(env, NULL, MDB_RDONLY, &txn));
LMDB_CHECK(mdbx_dbi_open(txn, db, MDB_CREATE, &dbi));
LMDB_CHECK(mdbx_stat(txn, dbi, &stat, sizeof(stat)));
LMDB_CHECK(mdbx_dbi_stat(txn, dbi, &stat, sizeof(stat)));
mdbx_txn_abort(txn);
printf("%15s | %15ld | %5u | %10ld | %10ld | %11ld |\n", db,
stat.ms_branch_pages, stat.ms_depth, stat.ms_entries,

View File

@ -230,7 +230,7 @@ static void get_db_stat(const char *db, int64_t *ms_branch_pages,
LMDB_CHECK(mdbx_txn_begin(env, NULL, MDB_RDONLY, &txn));
LMDB_CHECK(mdbx_dbi_open(txn, db, MDB_CREATE, &dbi));
LMDB_CHECK(mdbx_stat(txn, dbi, &stat, sizeof(stat)));
LMDB_CHECK(mdbx_dbi_stat(txn, dbi, &stat, sizeof(stat)));
mdbx_txn_abort(txn);
printf("%15s | %15ld | %5u | %10ld | %10ld | %11ld |\n", db,
stat.ms_branch_pages, stat.ms_depth, stat.ms_entries,