[Debtags-devel] tdb
Enrico Zini
enrico@enricozini.org
Mon, 11 Apr 2005 01:42:21 +0200
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
On Sun, Apr 10, 2005 at 03:48:31PM -0700, Erich Schubert wrote:
> Hi Debtaggers, Hi Enrico,
> Enrico, you wrote that you adopted my TDB code, but had to change some
> of my structures for your needs. Can you give me a short overview of
> the differences, so I can see if they fit my needs, so I could switch
> over to your database format?
> Sorry, I won't have much time to work on debtags right now. :-(
No problem.
I have this:
Item -> Tags mapping:
Key: "Idebtags" ("I" + package name)
Value: "implemented-in::c++\0suite::debian" (\0 separated list of
tag full names)
Tag -> Items mapping:
Key: "Tsuite::debian" ("T" + tag name)
Value: "debtags\0apt" (\0 separated list of package names)
Untagged packages:
Key: "T"
Value: (\0 separated list of package names)
That way I can get the tags for a package, the packages that have a tag,
and I can easily get the packages that have a certain tagset by
intersecting the item sets of every tag in the tagset.
I created 3 classes to handle this:
TDBDiskIndex
does read and write on disk
TDBIndexer
does everything in memory, and writes an index to disk on request
(used during debtag update: it's much faster working to memory,
and the resulting tdb file is more compact since it's written once
in a single pass and never updated)
TDBReadonlyDiskIndex
reads from a TDB index on disk, and keeps changes in an tag patch
(so handy to implement debtags-edit on top of this! The index is
owned by root, and debtags-edit only reads it, writing to a
separate patch file that can be directly submitted to the central
database!)
I started working in swig bindings for libdebtags, but it seems there's
a lot of work to do (hoping that std::set is iterable at all after
wrapping: so far it doesn't seem to be, I asked in the swig list, hope
for good clues).
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@enricozini.org>
--HcAYCG3uE/tztfnV
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)
iD8DBQFCWbnd9LSwzHl+v6sRAqjXAJ9jWsUE9geRMdEF++oJPxlBuSx2eACfbxw7
8G9X3/AT8tFX9LBTUDgpzjs=
=RLIY
-----END PGP SIGNATURE-----
--HcAYCG3uE/tztfnV--