-
Philip Withnall authored
This commit essentially moves the get_peer_credentials_async() function from MwsScheduleService into a new MwsPeerManagerDBus class, which has its interface abstracted as MwsPeerManagerInterface. The interface abstraction will be used in future to simplify unit testing of the scheduler. The scheduler now has a MwsPeerManager, which it uses to get the credentials of peers so that it can prioritise schedule entries from some peers (like eos-updater or gnome-software) over others. It does this by matching the peer’s executable path. Using an LSM label from the kernel would be better (it would avoid some race conditions with looking up PIDs, and avoid the possibility of /proc/$pid/exe being forged by processes) — but since we don’t use an LSM in EOS, we can’t use any LSM labels. Signalling of peers vanishing has moved from MwsScheduleService into the MwsPeerManager too, which means the MwsScheduler can now be notified directly of peers vanishing, rather than the MwsScheduleService having to propagate a notification to it with mws_scheduler_remove_entries_for_owner(). The overall aim of this commit (which it achieves) is to allow prioritising schedule entries by: 1. App extensions to com.endlessm.* apps (most important) 2. OS updates 3. App updates and app extensions to non-Endless apps 4. Any other schedule entries (least important) This is achieved by prioritising schedule entries by the peer which adds them, and then prioritising within that by the priority provided by the peer. Schedule entries from eos-updater and gnome-software are handled specially: they are ranked equally as peers, so the priorities they set on schedule entries are scoped together. By setting high and low priorities in gnome-software for different kinds of app updates, and medium priorities in eos-updater for OS updates, we should get rankings 1–3 from above. Ranking 4 is given by prioritising schedule entries from peers other than gnome-software and eos-updater below them. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://phabricator.endlessm.com/T21327
b915fa6f