[Rpm-maint] [rpm-software-management/rpm] Add keyring iterator API for accessing the keys in rpmKeyring (Issue #3337)

Panu Matilainen notifications at github.com
Wed Oct 9 07:05:02 UTC 2024


What be basically want here is three API functions, and an opaque iterator struct: 

- new-function to return an iterator from a keyring, with an unused flags argument for future expansion
- next-function that returns the next key as a weak reference 
- free-function to free up the iterator when done
- the iterator holds a read-only lock on the keyring *for its lifetime*
- the iterator holds a reference to the current key so that callers dont need to mess with it (unless they want to keep a reference) 

So adopting the stuff in the PR a bit, this is what we need:
- rpmKeyringIterator rpmKeyringInitIterator(rpmKeyring keyring, int unused); 
- rpmPubkey rpmKeyringIteratorNext(rpmKeyringIterator iterator);
- rpmKeyringIterator rpmKeyringIteratorFree(rpmKeyringIterator iterator);

Note Init instead of Get - this is commonly used in the codebase, and "int unused" for future expansion. Don't add any speculative filter code now, that only complicates things unnecessarily.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3337#issuecomment-2401500778
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3337/2401500778 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241009/1dfd3e8c/attachment.html>


More information about the Rpm-maint mailing list