Commit 6c5ecae8 authored by Daniel Salzman's avatar Daniel Salzman

kaspdb: remove unused kasp_db_list_zones

parent 68a8aa91
......@@ -404,44 +404,6 @@ int kasp_db_set_policy_last(knot_lmdb_db_t *db, const char *policy_string, const
return txn.ret;
}
static void add_dname_to_list(list_t *dst, const knot_dname_t *dname, int *ret)
{
ptrnode_t *n;
WALK_LIST(n, *dst) {
if (knot_dname_is_equal(n->d, dname)) {
return;
}
}
knot_dname_t *copy = knot_dname_copy(dname, NULL);
if (copy == NULL) {
*ret = KNOT_ENOMEM;
} else {
ptrlist_add(dst, copy, NULL);
}
}
int kasp_db_list_zones(knot_lmdb_db_t *db, list_t *dst)
{
knot_lmdb_txn_t txn = { 0 };
knot_lmdb_begin(db, &txn, false);
init_list(dst);
bool found = knot_lmdb_first(&txn);
while (found) {
const knot_dname_t *zone;
if (*(uint8_t *)txn.cur_key.mv_data != KASPDBKEY_POLICYLAST &&
knot_dname_size((zone = txn.cur_key.mv_data + 1)) < txn.cur_key.mv_size) {
add_dname_to_list(dst, zone, &txn.ret);
}
found = knot_lmdb_next(&txn);
}
knot_lmdb_abort(&txn);
if (txn.ret != KNOT_EOK) {
ptrlist_deep_free(dst, NULL);
return txn.ret;
}
return (EMPTY_LIST(*dst) ? KNOT_ENOENT : KNOT_EOK);
}
int kasp_db_store_offline_records(knot_lmdb_db_t *db, knot_time_t for_time, const key_records_t *r)
{
MDB_val k = make_key_time(KASPDBKEY_OFFLINE_RECORDS, r->rrsig.owner, for_time);
......
......@@ -185,18 +185,6 @@ int kasp_db_get_policy_last(knot_lmdb_db_t *db, const char *policy_string,
int kasp_db_set_policy_last(knot_lmdb_db_t *db, const char *policy_string, const char *last_lp_keyid,
const knot_dname_t *new_lp_zone, const char *new_lp_keyid);
/*!
* \brief List all zones that have anything stored in KASP db.
*
* It's quite slow, but we expect KASP db not to be so large.
*
* \param db KASP db
* \param dst List of zone names
*
* \return KNOT_E*
*/
int kasp_db_list_zones(knot_lmdb_db_t *db, list_t *dst);
/*!
* \brief Store pre-generated records for offline KSK usage.
*
......
......@@ -175,12 +175,6 @@ int main(int argc, char *argv[])
is_int(KNOT_EOK, ret, "kasp_db: load lastsigned_serial");
is_int(2, serial, "kasp_db: lastsigned_serial preserved");
ret = kasp_db_list_zones(db, &l);
is_int(KNOT_EOK, ret, "kasp_db: list_zones");
is_int(2, list_size(&l), "kasp_db: reports two zones");
is_int(0, knot_dname_cmp(((ptrnode_t *)HEAD(l))->d, zone1) | knot_dname_cmp(((ptrnode_t *)TAIL(l))->d, zone2), "kasp_db: listed correct zones");
ptrlist_deep_free(&l, NULL);
ret = kasp_db_add_key(db, zone1, &params1);
ok(ret == KNOT_EOK, "kasp_db: add key1");
ret = kasp_db_add_key(db, zone2, &params2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment