mdbx: refactor internal walking functions.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-07-27 23:01:48 +03:00
parent d6f397145c
commit 79465dbc7f
2 changed files with 12 additions and 12 deletions

View File

@ -3,17 +3,6 @@
#include "internals.h"
typedef struct walk_ctx {
void *userctx;
walk_options_t options;
int deep;
walk_func *visitor;
MDBX_txn *txn;
MDBX_cursor *cursor;
} walk_ctx_t;
__cold static int walk_tbl(walk_ctx_t *ctx, walk_tbl_t *tbl);
static page_type_t walk_page_type(const page_t *mp) {
if (mp)
switch (mp->flags & ~P_SPILLED) {
@ -251,7 +240,7 @@ __cold static int walk_pgno(walk_ctx_t *ctx, walk_tbl_t *tbl, const pgno_t pgno,
return MDBX_SUCCESS;
}
__cold static int walk_tbl(walk_ctx_t *ctx, walk_tbl_t *tbl) {
__cold int walk_tbl(walk_ctx_t *ctx, walk_tbl_t *tbl) {
tree_t *const db = tbl->internal;
if (unlikely(db->root == P_INVALID))
return MDBX_SUCCESS; /* empty db */

View File

@ -18,3 +18,14 @@ typedef int walk_func(const size_t pgno, const unsigned number, void *const ctx,
typedef enum walk_options { dont_check_keys_ordering = 1 } walk_options_t;
MDBX_INTERNAL int walk_pages(MDBX_txn *txn, walk_func *visitor, void *user, walk_options_t options);
typedef struct walk_ctx {
void *userctx;
walk_options_t options;
int deep;
walk_func *visitor;
MDBX_txn *txn;
MDBX_cursor *cursor;
} walk_ctx_t;
MDBX_INTERNAL int walk_tbl(walk_ctx_t *ctx, walk_tbl_t *tbl);