repo: Report metadata fetch progress separately

Partially resolves https://bugzilla.gnome.org/740276
This commit is contained in:
Matthew Barnes 2015-01-08 14:43:01 -05:00
parent 4b5b450d5c
commit 6ff841d3b0
2 changed files with 18 additions and 3 deletions

View File

@ -189,6 +189,10 @@ 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);
/* 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);
if (pull_data->fetching_sync_uri)
{
gs_free char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE);

View File

@ -2748,6 +2748,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
GString *buf;
gs_free char *status = NULL;
guint outstanding_fetches;
guint outstanding_metadata_fetches;
guint outstanding_writes;
guint n_scanned_metadata;
@ -2758,6 +2759,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
status = ostree_async_progress_get_status (progress);
outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches");
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");
if (status)
@ -2768,6 +2770,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
{
guint64 bytes_transferred = ostree_async_progress_get_uint64 (progress, "bytes-transferred");
guint fetched = ostree_async_progress_get_uint (progress, "fetched");
guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched");
guint requested = ostree_async_progress_get_uint (progress, "requested");
guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC;
gs_free char *formatted_bytes_transferred =
@ -2782,9 +2785,17 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
formatted_bytes_sec = g_format_size (bytes_sec);
}
g_string_append_printf (buf, "Receiving objects: %u%% (%u/%u) %s/s %s",
(guint)((((double)fetched) / requested) * 100),
fetched, requested, formatted_bytes_sec, formatted_bytes_transferred);
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);
}
else
{
g_string_append_printf (buf, "Receiving objects: %u%% (%u/%u) %s/s %s",
(guint)((((double)fetched) / requested) * 100),
fetched, requested, formatted_bytes_sec, formatted_bytes_transferred);
}
}
else if (outstanding_writes)
{