lib/cache: type safety of the cache API pointers
Merge request reports
Activity
added refactoring label
changed milestone to %5.2.0
mentioned in merge request !1025 (merged)
writing this properly without libknot would need 10-20 additional lines of code
I had written that before choosing the shorter committed variant, so I might just dump it here for reference:
struct lmdb_env *env = db2env(db); /* Gather required information. For more confidence we don't use * our "cached" env->mapsize and we use a fresh transaction. */ int ret = cdb_commit(db, stats); MDB_envinfo info; if (!ret) ret = lmdb_error(mdb_env_info(env->env, &info)); MDB_txn *txn = NULL; if (!ret) ret = txn_get(env, &txn, true); MDB_stat st; if (!ret) ret = lmdb_error(mdb_stat(txn, env->dbi, &st)); if (!ret) { free_txn_ro(env); // the TXN might be broken right now return kr_error(ret); } /* Formula copied from knot_db_lmdb_get_usage() but it's really simple. */ const size_t db_size = st.ms_psize * (st.ms_branch_pages + st.ms_leaf_pages + st.ms_overflow_pages); return (double)(100 * db_size) / info.me_mapsize;
@vcunat Please rebase this MR and I will review it again. It has conflicts with !1042 (merged).
assigned to @vcunat
added 48 commits
-
ae3acc00...0c8d0bd4 - 46 commits from branch
master
- d1d8cc2f - lib/cache: type safety of the cache API pointers
- 3e375558 - lib/cache kr_cdb_api::space_usage(): also use kr_cdb_pt
-
ae3acc00...0c8d0bd4 - 46 commits from branch
added 6 commits
-
3e375558...3a6c03b4 - 4 commits from branch
master
- 9bcdeff9 - lib/cache: type safety of the cache API pointers
- 9b469602 - lib/cache kr_cdb_api::space_usage(): also use kr_cdb_pt
-
3e375558...3a6c03b4 - 4 commits from branch
enabled an automatic merge when the pipeline for 9b469602 succeeds
mentioned in commit f742d3bc
mentioned in merge request !1060 (merged)
mentioned in issue #611 (closed)