[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Database class (similar to GDBM)
From:       David Faure <faure () kde ! org>
Date:       1999-11-15 22:28:39
[Download RAW message or body]

On Mon, Nov 15, 1999 at 10:05:18PM +0000, Rik Hemsley wrote:
> 
> Being bored on Sunday night, I decided I'd try to write a GDBM-style
> database within an hour, using only Qt. Looks like I did it, except that it
> took 1.5 hours :)
:-)

> The API is very similar to GDBM, as is the behaviour.
> 
> It is designed for caching data. I'm going to use it for Empath,
> to store various useful bits of information about mail messages,
> like the subject, date sent, etc, with the key being the MessageID.
> 
> David, you might fancy having a look. It does basically what KSycocaDict
> does, except that it doesn't rewrite the entire file every time you
> add/change a record.
> 
> If you add a record, it just gets appended at the end of the data file.

This is not acceptable for ksycoca, because for it order is important.
service types must be before services implementing them, and so on.

> If you replace a record and it's larger than the original, the original
> is ignored and the new version appended.
> 
> There's a reorganise() method which does the same as its counterpart
> in GDBM - it copies the database and replaces it, removing all unused
> stuff as it goes.
If it resorts the item, it fixes the thing above, but then the whole idea
drops :)

> The only real differences from GDBM are:
> * I couldn't be bothered to implement locking. Might do this later.
> * It uses two files - an index and a data file.
> * It doesn't sync() after each write. You can call sync() manually if
>   you want.
> 
> I've tested it with some large amounts of data (reading and writing /etc/*)
> and it seems pretty stable

That's nice.

If you don't mind, I think we shouldn't touch ksycoca. It works fine, with
very low memory usage, and redoing it if we don't gain anything is a waste of time :-)

-- 
David FAURE
david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic