Add GetPackagesDetails method to the interface
This method allows requesting information for multiple packages simultaneously, dramatically increasing performance when a lot of packages are required.
This seems to be the most sensible way to dramatically increase performance to have a decent refine function in the GS plugin:
Before:
user@alpine-edge:~/data/Informatica/postmarketOS/software/apk-polkit-rs$ time for i in {1..5}; do gdbus call -y --dest dev.Cogitri.apkPolkit1 --object-path /dev/Cogitri/apkPolkit1 --method dev.Cogitri.apkPolkit1.GetPackageDetails "gnome-software"; done
(('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1),)
(('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1),)
(('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1),)
(('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1),)
(('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1),)
real 0m1.865s
user 0m0.017s
sys 0m0.008s
After:
user@alpine-edge:~/data/Informatica/postmarketOS/software/apk-polkit-rs$ time gdbus call -y --dest dev.Cogitri.apkPolkit1 --object-path /dev/Cogitri/apkPolkit1 --method dev.Cogitri.apkPolkit1.GetPackagesDetails '["gnome-software", "gnome-contacts", "gnome-feeds", "gnome-terminal", "gnome-console"]'
([('gnome-software', '41.5-r0', 'Software lets you install and update applications and system extensions', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Software', uint64 2330624, uint64 588503, uint32 1), ('gnome-contacts', '42.0-r1', 'A contacts manager for GNOME', 'GPL-2.0-or-later', '', 'https://wiki.gnome.org/Apps/Contacts', 778240, 238984, 0), ('gnome-feeds', '1.0.3-r2', 'RSS/Atom feed reader for GNOME', 'GPL-3.0-or-later', '', 'https://gitlab.gnome.org/World/gfeeds', 512000, 78169, 0), ('gnome-terminal', '3.44.0-r1', 'GNOME terminal emulator application', 'GPL-2.0-or-later AND GFDL-1.3-only', '', 'https://wiki.gnome.org/Apps/Terminal', 860160, 253809, 1), ('gnome-console', '42_beta-r0', 'User-friendly terminal for GNOME', 'GPL-3.0-only', '', 'https://gitlab.gnome.org/GNOME/console', 286720, 88696, 0)],)
real 0m0.296s
user 0m0.006s
sys 0m0.000s
I tried very hard to not copy code, and instead of creating a get_packages_details
db method, run a for loop in the server for get_package_details
over the same db. However, I am a total noob in Rust and hit myself against the wall for multiple hours in a row. At least this is working.
Also, probably having the single package method in the interface makes a lot less sense now. I kept it for compatibility, but probably wouldn't be too bad to remove it, since gnome-software-plugin-apk
is the only existent consumer.