From cd116a1e63aa9c7114b3ca5ee804fdafa57360af Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Sun, 10 Sep 2023 22:14:39 -0400 Subject: [PATCH] lib/pull: Drop static delta superblocks references We don't need them long-lived anymore. They were just used for reporting at this point, but we can use the new `static_delta_targets` hash table size for that now. --- src/libostree/ostree-repo-pull-private.h | 2 +- src/libostree/ostree-repo-pull.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libostree/ostree-repo-pull-private.h b/src/libostree/ostree-repo-pull-private.h index 2a0b7f44b1..651c4826f8 100644 --- a/src/libostree/ostree-repo-pull-private.h +++ b/src/libostree/ostree-repo-pull-private.h @@ -88,7 +88,7 @@ typedef struct GHashTable *signapi_verified_commits; /* Map of commits that have been signapi verified */ GHashTable *ref_keyring_map; /* Maps OstreeCollectionRef to keyring remote name */ - GPtrArray *static_delta_superblocks; + GHashTable *static_delta_targets; /* Set of commits fetched via static delta */ GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */ diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 6822028c27..f273639e7f 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -210,7 +210,7 @@ update_progress (gpointer user_data) pull_data->fetched_deltapart_size, "total-delta-part-size", "t", pull_data->total_deltapart_size, "total-delta-part-usize", "t", pull_data->total_deltapart_usize, "total-delta-superblocks", "u", - pull_data->static_delta_superblocks->len, + g_hash_table_size (pull_data->static_delta_targets), /* We fetch metadata before content. These allow us to report metadata fetch progress specifically. */ "outstanding-metadata-fetches", "u", pull_data->n_outstanding_metadata_fetches, @@ -2469,7 +2469,6 @@ on_superblock_fetched (GObject *src, GAsyncResult *res, gpointer data) delta_superblock = g_variant_ref_sink (g_variant_new_from_bytes ( (GVariantType *)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT, delta_superblock_data, FALSE)); - g_ptr_array_add (pull_data->static_delta_superblocks, g_variant_ref (delta_superblock)); g_hash_table_add (pull_data->static_delta_targets, g_strdup (to_revision)); if (!process_one_static_delta (pull_data, from_revision, to_revision, delta_superblock, fetch_data->requested_ref, pull_data->cancellable, error)) @@ -4052,8 +4051,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *remote_name_or_base need_summary = TRUE; } - pull_data->static_delta_superblocks - = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref); pull_data->static_delta_targets = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL); @@ -4910,7 +4907,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *remote_name_or_base g_clear_pointer (&pull_data->summary_data_sig, g_bytes_unref); g_clear_pointer (&pull_data->summary_sig_etag, g_free); g_clear_pointer (&pull_data->summary, g_variant_unref); - g_clear_pointer (&pull_data->static_delta_superblocks, g_ptr_array_unref); g_clear_pointer (&pull_data->static_delta_targets, g_hash_table_unref); g_clear_pointer (&pull_data->commit_to_depth, g_hash_table_unref); g_clear_pointer (&pull_data->expected_commit_sizes, g_hash_table_unref);