Re: any support for deleting an entry from cdb file?

[email protected] (Paul Jarc) Mon, 11 Apr 2005 16:10:30 -0400
Newsgroups gmane.comp.djb.cdb
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Dev Man <[email protected]> wrote:
> Is there any way to delete records from the CDB database?

The library doesn't currently provide that.

> If not, is it feasible to add?

It depends on what you mean, exactly.  Remember the "c" is for
"constant" - the database is never modified after it's created.
Instead, you create a new version of the database as a temporary file,
and atomically rename that file overe the original.

So there are two kinds of deletion that might make sense: removing one
of the just-added records during creation of a new database, or
creating a new version of a database that contains most of the old
records, with a few missing.  The first doesn't seem too useful.

The second could be useful in the case where there is no higher-level
source that the cdb is built from, although that's uncommon.  It
requires a library function to iterate through the records in the old
database, which is not in cdb-0.75, but is around somewhere - check
the archives.


paul