libalpm: add iterator interface for syncdb files
This commit adds an iterator interface for reading files from the syncdbs. Instead of using alpm_pkg_get_files(), you now get the files from the database using alpm_db_files_open(), you then use alpm_db_files_next() to iterate through the files for each package. If you want to actually load the files from that package you then use alpm_db_files_load(). This means alpm_pkg_get_files() will always return empty for syncdbs, even on .files databases, however these functions still work on the localdb and loaded packages. This aproach is faster when dumping the entire file list but slower when searching for a specific package. The memory usage of pacman is drastically less. See below. build/pacman -Fl 0.55s user 0.01s system 99% cpu 0.556 total build/pacman -Fl pacman 0.46s user 0.01s system 99% cpu 0.472 total build/pacman -Fx pacman 2.88s user 0.09s system 99% cpu 2.965 total pacman -Fl 1.60s user 0.13s system 99% cpu 1.731 total pacman -Fl pacman 0.24s user 0.04s system 99% cpu 0.283 total pacman -Fx pacman 2.45s user 0.14s system 99% cpu 2.593 total Peak Memory build/pacman -Fl 43.52MB build/pacman -Fl pacmam 11.292MB pacman -Fl 677.048MB pacman -Fl pacman 163.288MB
Showing
- lib/libalpm/alpm.h 44 additions, 1 deletionlib/libalpm/alpm.h
- lib/libalpm/be_sync.c 150 additions, 32 deletionslib/libalpm/be_sync.c
- lib/libalpm/db.h 7 additions, 0 deletionslib/libalpm/db.h
- lib/libalpm/filelist.c 14 additions, 0 deletionslib/libalpm/filelist.c
- lib/libalpm/filelist.h 1 addition, 0 deletionslib/libalpm/filelist.h
- lib/libalpm/package.c 1 addition, 0 deletionslib/libalpm/package.c
- src/pacman/files.c 127 additions, 82 deletionssrc/pacman/files.c
Loading
Please register or sign in to comment