Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for asking whether the pool is empty #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aleixpol
Copy link
Collaborator

On certain systems a refresh is necessary in such cases and, in any case, it's useful to know whether queries are pointless.


I wonder if it would make sense to be more specific about what we are looking up, since I guess it could be getting confused by fwupd or flatpak...

Copy link
Owner

@ximion ximion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few changes needed.
AsCache should expose a more low-level API, so returning a component-count makes a lot of sense here, as we will probably want to have that value returned by the pool anyway as well (so a software center can also refresh if the amount of components looks suspiciously low). but the is_empty function can be built upon that.
Also, so _get_ prefix is needed for _is_*-style functions.

The way emptyness is determined is super inefficient here, but if you want to I could fix that up for you in a follow-up commit once this PR is merged (at the moment we deserialize all data and then throw it away just to determine the amount of stuff in the cache, so we at least need to stop doing that. But there's even more efficient methods to do determine the amount of cache entries).

src/as-cache.c Show resolved Hide resolved
src/as-cache.c Outdated Show resolved Hide resolved
src/as-cache.c Outdated Show resolved Hide resolved
src/as-pool.c Outdated Show resolved Hide resolved
src/as-pool.c Outdated Show resolved Hide resolved
tests/test-pool.c Outdated Show resolved Hide resolved
tests/test-pool.c Outdated Show resolved Hide resolved
src/as-pool.c Outdated Show resolved Hide resolved
src/as-cache.h Outdated Show resolved Hide resolved
tests/test-pool.c Outdated Show resolved Hide resolved
On certain systems a refresh is necessary in such cases and, in any
case, it's useful to know whether queries are pointless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants