[ostree] repo: use the skip summary download optimization for repo_remote_fetch_summary
- From: Giuseppe Scrivano <gscrivano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: use the skip summary download optimization for repo_remote_fetch_summary
- Date: Tue, 15 Mar 2016 08:49:46 +0000 (UTC)
commit 2bf84d7e5dee96f49e8ead32fffb1dfefb845f4b
Author: Giuseppe Scrivano <gscrivan redhat com>
Date: Fri Mar 11 13:16:04 2016 +0100
repo: use the skip summary download optimization for repo_remote_fetch_summary
Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
src/libostree/ostree-repo.c | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 25cfcb8..facc332 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1750,9 +1750,7 @@ repo_remote_fetch_summary (OstreeRepo *self,
g_autoptr(GMainContext) mainctx = NULL;
gboolean ret = FALSE;
SoupURI *base_uri = NULL;
- uint i;
- const char *filenames[] = {"summary", "summary.sig"};
- GBytes **outputs[] = {out_summary, out_signatures};
+ gboolean from_cache = FALSE;
mainctx = g_main_context_new ();
g_main_context_push_thread_default (mainctx);
@@ -1782,20 +1780,42 @@ repo_remote_fetch_summary (OstreeRepo *self,
}
}
- for (i = 0; i < G_N_ELEMENTS (filenames); i++)
+ if (!_ostree_preload_metadata_file (self,
+ fetcher,
+ base_uri,
+ "summary.sig",
+ metalink_url_string ? TRUE : FALSE,
+ out_signatures,
+ cancellable,
+ error))
+ goto out;
+
+ if (*out_signatures)
+ {
+ if (!_ostree_repo_load_cache_summary_if_same_sig (self,
+ name,
+ *out_signatures,
+ out_summary,
+ cancellable,
+ error))
+ goto out;
+ }
+
+ if (*out_summary)
+ from_cache = TRUE;
{
if (!_ostree_preload_metadata_file (self,
fetcher,
base_uri,
- filenames[i],
+ "summary",
metalink_url_string ? TRUE : FALSE,
- outputs[i],
+ out_summary,
cancellable,
error))
goto out;
}
- if (*out_summary && *out_signatures)
+ if (!from_cache && *out_summary && *out_signatures)
{
if (!_ostree_repo_cache_summary (self,
name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]