[ostree] pull: Further extend static delta progress
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Further extend static delta progress
- Date: Thu, 22 Jan 2015 16:58:00 +0000 (UTC)
commit f2e4830409d9b1efc830b16ea99a346d07c6f46e
Author: Colin Walters <walters verbum org>
Date: Wed Jan 21 17:53:52 2015 -0500
pull: Further extend static delta progress
With deltas, we have an accurate total size, among other things.
src/libostree/ostree-repo-pull.c | 26 +++++++++++++++++++++++---
src/libostree/ostree-repo.c | 17 ++++++++++++++++-
2 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 7fc1eb5..b933001 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -59,7 +59,7 @@ typedef struct {
gboolean gpg_verify;
GVariant *summary;
- GPtrArray *static_delta_metas;
+ GPtrArray *static_delta_superblocks;
GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */
GHashTable *commit_to_depth; /* Maps commit checksum maximum depth */
GHashTable *scanned_metadata; /* Maps object name to itself */
@@ -71,6 +71,8 @@ typedef struct {
guint n_outstanding_content_write_requests;
guint n_outstanding_deltapart_fetches;
guint n_outstanding_deltapart_write_requests;
+ guint n_total_deltaparts;
+ guint64 total_deltapart_size;
gint n_requested_metadata;
gint n_requested_content;
guint n_fetched_deltaparts;
@@ -192,6 +194,16 @@ update_progress (gpointer user_data)
ostree_async_progress_set_uint64 (pull_data->progress, "bytes-transferred", bytes_transferred);
ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time);
+ /* Deltas */
+ ostree_async_progress_set_uint (pull_data->progress, "fetched-delta-parts",
+ pull_data->n_fetched_deltaparts);
+ ostree_async_progress_set_uint (pull_data->progress, "total-delta-parts",
+ pull_data->n_total_deltaparts);
+ ostree_async_progress_set_uint64 (pull_data->progress, "total-delta-part-size",
+ pull_data->total_deltapart_size);
+ ostree_async_progress_set_uint (pull_data->progress, "total-delta-superblocks",
+ pull_data->static_delta_superblocks->len);
+
/* We fetch metadata before content. These allow us to report metadata fetch progress specifically. */
ostree_async_progress_set_uint (pull_data->progress, "outstanding-metadata-fetches",
pull_data->n_outstanding_metadata_fetches);
ostree_async_progress_set_uint (pull_data->progress, "metadata-fetched", pull_data->n_fetched_metadata);
@@ -1345,6 +1357,8 @@ process_one_static_delta_fallback (OtPullData *pull_data,
objtype = (OstreeObjectType)objtype_y;
checksum = ostree_checksum_from_bytes_v (csum_v);
+ pull_data->total_deltapart_size += compressed_size;
+
if (!ostree_repo_has_object (pull_data->repo, objtype, checksum,
&is_stored,
cancellable, error))
@@ -1444,6 +1458,8 @@ process_one_static_delta (OtPullData *pull_data,
}
n = g_variant_n_children (headers);
+ pull_data->n_total_deltaparts += n;
+
for (i = 0; i < n; i++)
{
const guchar *csum;
@@ -1463,6 +1479,8 @@ process_one_static_delta (OtPullData *pull_data,
if (!csum)
goto out;
+ pull_data->total_deltapart_size += size;
+
if (!_ostree_repo_static_delta_part_have_all_objects (pull_data->repo,
objects,
&have_all,
@@ -1474,6 +1492,7 @@ process_one_static_delta (OtPullData *pull_data,
g_debug ("Have all objects from static delta %s-%s part %u",
from_revision ? from_revision : "empty", to_revision,
i);
+ pull_data->n_fetched_deltaparts++;
continue;
}
@@ -1803,7 +1822,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
goto out;
}
- pull_data->static_delta_metas = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
+ pull_data->static_delta_superblocks = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
if (is_mirror && !refs_to_fetch && !configured_branches)
{
@@ -1963,6 +1982,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
else
{
g_debug ("processing delta superblock for %s-%s", from_revision ? from_revision : "empty",
to_revision);
+ g_ptr_array_add (pull_data->static_delta_superblocks, g_variant_ref (delta_superblock));
if (!process_one_static_delta (pull_data, from_revision, to_revision,
delta_superblock,
cancellable, error))
@@ -2083,7 +2103,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
if (pull_data->base_uri)
soup_uri_free (pull_data->base_uri);
g_clear_pointer (&pull_data->summary, (GDestroyNotify) g_variant_unref);
- g_clear_pointer (&pull_data->static_delta_metas, (GDestroyNotify) g_ptr_array_unref);
+ g_clear_pointer (&pull_data->static_delta_superblocks, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->commit_to_depth, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->expected_commit_sizes, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->scanned_metadata, (GDestroyNotify) g_hash_table_unref);
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 22abe91..f27911d 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2767,6 +2767,8 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
guint outstanding_metadata_fetches;
guint outstanding_writes;
guint n_scanned_metadata;
+ guint fetched_delta_parts;
+ guint total_delta_parts;
if (!console)
return;
@@ -2778,6 +2780,9 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
outstanding_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches");
outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata");
+ fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts");
+ total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts");
+
if (status)
{
g_string_append (buf, status);
@@ -2801,7 +2806,17 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
formatted_bytes_sec = g_format_size (bytes_sec);
}
- if (outstanding_metadata_fetches)
+ if (total_delta_parts > 0)
+ {
+ guint64 total_delta_part_size = ostree_async_progress_get_uint64 (progress,
"total-delta-part-size");
+ gs_free char *formatted_total =
+ g_format_size (total_delta_part_size);
+ g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s",
+ fetched_delta_parts, total_delta_parts,
+ formatted_bytes_sec, formatted_bytes_transferred,
+ formatted_total);
+ }
+ else if (outstanding_metadata_fetches)
{
g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s",
metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]