summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-08-07 16:19:58 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2020-08-24 08:58:08 +0200
commit95bef8e4a5a113dd125acb3099342add46de6263 (patch)
tree9c1776b78879b5f1e7a41455f46dd5cb4c91b372
parentd57db7074b0d15081290c6a06f7ce7e44aebb632 (diff)
downloadflatpak-95bef8e4a5a113dd125acb3099342add46de6263.tar.gz
flatpak-dir: Cache the summary GBytes in FlatpakRemoteState
`FlatpakRemoteState` already caches the parsed `GVariant` form of the summary, but it will be useful (in the following commits) to also have a pointer to the `GBytes` which backs that variant. The `GBytes` will be passed into OSTree in the following commits, to allow it to avoid unnecessarily re-downloading the `summary` file. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--common/flatpak-dir-private.h1
-rw-r--r--common/flatpak-dir.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/common/flatpak-dir-private.h b/common/flatpak-dir-private.h
index 02c44f40..de8d047b 100644
--- a/common/flatpak-dir-private.h
+++ b/common/flatpak-dir-private.h
@@ -120,6 +120,7 @@ typedef struct
char *remote_name;
char *collection_id;
GVariant *summary;
+ GBytes *summary_bytes;
GBytes *summary_sig_bytes;
GError *summary_fetch_error;
GRegex *allow_refs;
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 7aae8ffa..93b5c553 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -335,6 +335,7 @@ flatpak_remote_state_unref (FlatpakRemoteState *remote_state)
g_free (remote_state->remote_name);
g_free (remote_state->collection_id);
g_clear_pointer (&remote_state->summary, g_variant_unref);
+ g_clear_pointer (&remote_state->summary_bytes, g_bytes_unref);
g_clear_pointer (&remote_state->summary_sig_bytes, g_bytes_unref);
g_clear_error (&remote_state->summary_fetch_error);
g_clear_pointer (&remote_state->allow_refs, g_regex_unref);
@@ -10899,6 +10900,7 @@ _flatpak_dir_get_remote_state (FlatpakDir *self,
state->summary_sig_bytes = g_bytes_ref (opt_summary_sig);
}
+ state->summary_bytes = g_bytes_ref (opt_summary);
state->summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
opt_summary, FALSE));
}
@@ -10914,6 +10916,7 @@ _flatpak_dir_get_remote_state (FlatpakDir *self,
state->summary_sig_bytes = g_steal_pointer (&summary_sig_bytes);
state->summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
summary_bytes, FALSE));
+ state->summary_bytes = g_steal_pointer (&summary_bytes);
}
else
{