lib/repo-finder: Add basic support for finding remote URIs by ref name

Add an initial OstreeRepoFinder interface (but no implementations),
which will find remote URIs by ref names and collection IDs, the
combination of which is globally unique.

The new API is used in a new ostree_repo_find_updates() function, which
resolves a list of ref names to update into a set of remote URIs to pull
them from, which can be treated as mirrors. It is an attempt to
generalise resolution of the URIs to pull from, and to generalise
determination of the order and parallelisation which they should be
downloaded from in.

Includes fixes by Krzesimir Nowak <krzesimir@kinvolk.io>.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #924
Approved by: cgwalters
This commit is contained in:
Philip Withnall authored and Atomic Bot committed 2017-06-26 15:56:07 +00:00
1 parent 7607d94713
commit 292230301d
11 files changed
+2179 -2

No files matched your search

+61
View File
@@ -27,6 +27,7 @@
#include "ostree-async-progress.h"
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
#include "ostree-ref.h"
#include "ostree-repo-finder.h"
#endif
#include "ostree-sepolicy.h"
#include "ostree-gpg-verify-result.h"
@@ -1080,6 +1081,33 @@ ostree_repo_pull_one_dir (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
#if 0
FIXME
Called with: remote_name, refs, override-commit-ids
or: URL, refs, override-commit-ids
=> we only need refs; could use the remote_name or URL as additional results
Summary file is downloaded first, so this would result in multiple downloads of
the summary, but we don’t care because of caching.
Big problem preventing this from being the overall API: presenting the download
sizes in the gnome-software UI before the user chooses to download.
_OSTREE_PUBLIC
gboolean ostree_repo_find_remotes_squashed (OstreeRepo *self,
const gchar * const *refs, -> options
GVariant *options,
OstreeRepoFinder **finders, -> options
GMainContext *context, -> nope
OstreeAsyncProgress *progress,
GCancellable *cancellable,
GError **error);
#endif
_OSTREE_PUBLIC
gboolean ostree_repo_pull_with_options (OstreeRepo *self,
const char *remote_name_or_baseurl,
@@ -1090,6 +1118,39 @@ gboolean ostree_repo_pull_with_options (OstreeRepo *self,
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
_OSTREE_PUBLIC
void ostree_repo_find_remotes_async (OstreeRepo *self,
const OstreeCollectionRef * const *refs,
GVariant *options,
OstreeRepoFinder **finders,
OstreeAsyncProgress *progress,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
_OSTREE_PUBLIC
OstreeRepoFinderResult **ostree_repo_find_remotes_finish (OstreeRepo *self,
GAsyncResult *result,
GError **error);
_OSTREE_PUBLIC
void ostree_repo_pull_from_remotes_async (OstreeRepo *self,
const OstreeRepoFinderResult * const *results,
GVariant *options,
OstreeAsyncProgress *progress,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
_OSTREE_PUBLIC
gboolean ostree_repo_pull_from_remotes_finish (OstreeRepo *self,
GAsyncResult *result,
GError **error);
_OSTREE_PUBLIC
gchar *ostree_repo_resolve_keyring_for_collection (OstreeRepo *self,
const gchar *collection_id,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_list_collection_refs (OstreeRepo *self,
const char *match_collection_id,