On 03/08/2013 04:37 PM, Michael Schroeder wrote:
Anyway, attached is a little Packages database implementation I did yesterday
and today. The code is very careful not to destroy things if the database
is corrupt, i.e. it makes sure that it does not overwrite data.

Apart from implementation details, this also serves as a starting point for the pkg db API abstraction:

int rpmpkgOpen(rpmpkgdb *pkgdbp, const char *filename, int flags, int mode);
void rpmpkgClose(rpmpkgdb pkgdbp);
void rpmpkgSetFsync(rpmpkgdb pkgdbp, int dofsync);
int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp); int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl);
int rpmpkgErase(rpmpkgdb pkgdb, unsigned int pkgidx);

Its going to need some kind of cursor/iterator interface to allow walking through all the elements in the db, but that's pretty much it (except for the inevitably forgotten pesky little details :)

Adjusting the BDB implementation into something resembling that
should make for a fun little refactoring excercise... Separating the package db from the index implementation and forcing more abstract APIs over them will make the codebase saner no matter what comes out of this all, and will allow further freedom for experimenting with different implementations.

        - Panu -


_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to