[Debtags-devel] tdb

Enrico Zini enrico@enricozini.org
Tue, 12 Apr 2005 22:21:20 +0200


--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Apr 12, 2005 at 08:03:56AM +0200, Benjamin Mesing wrote:

> > Yes, in the past I used integers as well.  However, now the tagcoll and
> > debtags code has gone much more complex, and maintaining an int <-> tag
> > and an int <-> package mapping is a layer of complexity that I'd like to
> > avoid.
> Hey, does that mean that libtagcoll works with strings instead of ints
> now?? Please don't say its true, packagesearch uses 'int's for reference
> of packages all over - well I would have to map debtags results to ints
> than.

Not really: it's all based on generic programming, so you can provide a
serializer that converts the package names in the index file to your
ints, and that will make a bit deal of libdebtags to use your ints :)


> > Note that I'm already mapping Debtags' idea of packages to libapt's idea
> > of packages;=20
> Only for my understanding: libapt maps to memory but because they use
> mmap every change in the apt database results in changes of the memory
> making a reindexing neccessary correct? Sorry for asking those linux
> related questions here lately, but I really want to *know* my OS :-)

Yes: mmapped memory is not memory, it's disk blocks that you access like
they were memory.  So, if an apt-get update changes the contents of the
file you have mmapped, then the contents of that "memory" change as
well.

mmap is supercool!  Whenever you have a file with fixed-length records,
you can just mmap it and cast it to an array of structures :)

Or, if you have an index into a text file, you map the text file and use
the offsets from the index as offsets in the memory buffer: no seeks, no
reads, it just works :)


Ciao,

Enrico

--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@enricozini.org>

--opJtzjQTFsWo+cga
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCXC3A9LSwzHl+v6sRAvMQAJ459tfsgXq1qkj2FH1ivenVozUP2wCgkrYV
3oD6BPEa6/ZVLyNgz9fj3dg=
=0LQA
-----END PGP SIGNATURE-----

--opJtzjQTFsWo+cga--