Re: any support for deleting an entry from cdb file?
David Phillips <[email protected]> Wed, 13 Apr 2005 08:50:36 -0500
| Newsgroups | gmane.comp.djb.cdb |
|---|---|
| Message-ID | <[email protected]> |
On 4/12/05, Pedro Melo Cunha <[email protected]> wrote: > In an application I wrote, I needed to invalidade an entry of the CDB, > to delete it. What I did, was this: each data element has an extra byte > prefix, state. Initially the state is a space. If I want to delete it, > I put a 'X' there. This should be safe because one byte writes are atomic. > Update is possible, but even more hackish: if your update data is > smaller than the original data, and the key is the same, you could just > write to the CDB You will need to add locking if you do this, since writing more than one byte is not guaranteed to be atomic. --=20 David Phillips <[email protected]> http://david.acz.org/