dbh_erase(3)

πŸ“¦ version 5.0.22, in fedora 43, fedora 44

πŸ’– dbh_erase(3) β€” the DBHashTables Programmers' Manual, bestie edition ✨

okay so welcome to the DBHashTables Programmers' Manual, section 3, page dbh_erase. This is your one-stop group chat for deleting stuff (emotionally and structurally) πŸ’…


🌸 NAME 🌸

dbh_erase, dbh_unerase, dbh_prune.3, dbh_unprune.3 β€” erase/unerase records or prune/unprune entire branches


πŸŽ€ SYNOPSIS πŸŽ€

#include <dbh.h>

int dbh_erase (DBHashTable *dbh);
int dbh_unerase (DBHashTable *dbh);
int dbh_prune (DBHashTable *dbh, unsigned char *key, unsigned char
subtree_length);
int dbh_unprune (DBHashTable *dbh, unsigned char *key, unsigned char
subtree_length);

✨ DESCRIPTION ✨

πŸ’œ dbh_erase

Marks the record that's currently loaded into memory as erased. That's it, that's the whole thing.

🚨 bestie listen: if there's no record currently loaded, the behaviour is undefined. Like, genuinely undefined. Don't do it. Not the vibe.

πŸ¦‹ dbh_unerase

This one is the opposite of dbh_erase (). It marks the record currently loaded into memory as unerased β€” putting it back, un-cancelling it, restoring the girlies.

πŸ™ˆ and again: if no record is currently loaded, behaviour is undefined. Same rules, same drama.

πŸ“ dbh_prune

Erases a whole subtree from the record currently loaded into memory. It's giving spring cleaning but make it data structures 🧹

Important tea tho: the records are not really removed fisically, they're just marked erased so they may be recovered β€” if they haven't been overwritten later on. So it's less "deleted" and more "put in the group chat archive."

They only get permanently removed after the DBHashTable is reconstructed with dbh_regen_sweep () or dbh_regen_fanout (). that's when it's actually gone gone πŸ’€

🌈 dbh_unprune

Does the opposite of dbh_prune (), marking the entire subtree as unerased. Undo button, slay.

😭 but fair warning: it may fail to work if records have been overwritten since the dbh_prune () instruction was issued. No cap. Once it's overwritten, the un-prune can't save you.

πŸ”‘ the key and subtree_length situation

In the dbh_prune and dbh_unprune routines:

  • key is the key of the top level record of the subtree to erase
  • subtree_length is the number of branches to erase

⭐ RETURN VALUE ⭐

  • 0 on error
  • 1 otherwise

periodt. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

  • dbh (0)
  • dbh_find (3)
  • dbh_load (3)
  • dbh_sweep (3)
  • dbh_regen_sweep (3)

πŸ’– Author πŸ’–

Edscott Wilson Garcia <edscott@xfce.org>


and that's the page!! brought to you by the DBHashTables manual, section DBH, filed under dbh_erase(3) β€” go forth and erase responsibly, bestie 🫢🌸

πŸ“¦ where this page comes from