diff options
author | Colin Walters <walters@verbum.org> | 2017-02-10 14:29:54 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-02-17 14:58:25 +0000 |
commit | e1118e320d6c71a9b678b1dee395687889d51422 (patch) | |
tree | 6be80d12b5a268e755d70e041f2be19cc793e9d9 /src/ostree/ot-builtin-pull.c | |
parent | 0142e5ff393d4fc9e781d22cfea2e68a95a69dae (diff) | |
download | ostree-e1118e320d6c71a9b678b1dee395687889d51422.tar.gz |
repo: Fix static delta progress display
There were a few bugs here.
- We need to keep track of the size of the delta parts we've already processed,
in order to make progress reliable at all in the face of interruptions. Add
a new `fetched-delta-part-size` async progress variable for this.
- The total before disregarded what we'd already downloaded, which was confusing.
Now, a progress percentage is `fetched/total`.
- Correctly handle "unknown bytes/sec" in the progress display.
However, to be fully correct we need to show the fallback objects too. That
would require tracking in the pull code when we fetch an object as a fallback
versus "normally". This would be simpler really if we could assume in a run we
were *only* processing a delta, but currently we don't do that.
Related: https://github.com/ostreedev/ostree/issues/475
Closes: #678
Approved by: giuseppe
Diffstat (limited to 'src/ostree/ot-builtin-pull.c')
-rw-r--r-- | src/ostree/ot-builtin-pull.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index f370ca01..7df48002 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -80,7 +80,7 @@ dry_run_console_progress_changed (OstreeAsyncProgress *progress, gpointer user_data) { guint fetched_delta_parts, total_delta_parts; - guint64 total_delta_part_size, total_delta_part_usize; + guint64 fetched_delta_part_size, total_delta_part_size, total_delta_part_usize; GString *buf; g_assert (!printed_console_progress); @@ -88,19 +88,23 @@ dry_run_console_progress_changed (OstreeAsyncProgress *progress, fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts"); total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts"); + fetched_delta_part_size = ostree_async_progress_get_uint64 (progress, "fetched-delta-part-size"); total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size"); total_delta_part_usize = ostree_async_progress_get_uint64 (progress, "total-delta-part-usize"); buf = g_string_new (""); - { g_autofree char *formatted_size = + { g_autofree char *formatted_fetched = + g_format_size (fetched_delta_part_size); + g_autofree char *formatted_size = g_format_size (total_delta_part_size); g_autofree char *formatted_usize = g_format_size (total_delta_part_usize); - g_string_append_printf (buf, "Delta update: %u/%u parts, %s to transfer, %s uncompressed", + g_string_append_printf (buf, "Delta update: %u/%u parts, %s/%s, %s total uncompressed", fetched_delta_parts, total_delta_parts, - formatted_size, formatted_usize); + formatted_fetched, formatted_size, + formatted_usize); } g_print ("%s\n", buf->str); g_string_free (buf, TRUE); |