[yast-devel] Sorting in libstorage-ng
Hi,
as discussed yesterday after the daily call there is a small
change to libstorage-ng:
Change:
libstorage-ng now provides compare functions,
e.g. Partitionable::compare_by_name(), to sort devices. As a
countermove functions that retrieve vectors of devices no longer
sort the result.
Motivation:
- Allow to sort a combined list of e.g. disks and DASDs
individual retrieved by Disk::get_all() and Dasd::get_all().
- Allow special sorting, e.g. disks in general by name but USB
disks at the end (see
https://github.com/openSUSE/libstorage-ng/tree/master/integration-tests/misc...).
- Avoid sorting when it is unneeded.
Notes:
- The compare functions are C++ style: Compare for less than and
return a boolean. When used in Python or Ruby the result must
likely be mapped to ±1. The interface may change when C++
supports the spaceship operator.
- Most compare functions are trivial.
- Some functions in libstorage-ng still sort the result since
that is currently needed by the yast2-storage-ng testsuite
(LvmLvs AFAIS) and the expert partitioner.
ciao
Arvin
--
Arvin Schnell,
participants (1)
-
Arvin Schnell