pull: Further extend static delta progress
With deltas, we have an accurate total size, among other things.
This commit is contained in:
parent
e40b86221a
commit
f2e4830409
|
|
@ -59,7 +59,7 @@ typedef struct {
|
||||||
gboolean gpg_verify;
|
gboolean gpg_verify;
|
||||||
|
|
||||||
GVariant *summary;
|
GVariant *summary;
|
||||||
GPtrArray *static_delta_metas;
|
GPtrArray *static_delta_superblocks;
|
||||||
GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */
|
GHashTable *expected_commit_sizes; /* Maps commit checksum to known size */
|
||||||
GHashTable *commit_to_depth; /* Maps commit checksum maximum depth */
|
GHashTable *commit_to_depth; /* Maps commit checksum maximum depth */
|
||||||
GHashTable *scanned_metadata; /* Maps object name to itself */
|
GHashTable *scanned_metadata; /* Maps object name to itself */
|
||||||
|
|
@ -71,6 +71,8 @@ typedef struct {
|
||||||
guint n_outstanding_content_write_requests;
|
guint n_outstanding_content_write_requests;
|
||||||
guint n_outstanding_deltapart_fetches;
|
guint n_outstanding_deltapart_fetches;
|
||||||
guint n_outstanding_deltapart_write_requests;
|
guint n_outstanding_deltapart_write_requests;
|
||||||
|
guint n_total_deltaparts;
|
||||||
|
guint64 total_deltapart_size;
|
||||||
gint n_requested_metadata;
|
gint n_requested_metadata;
|
||||||
gint n_requested_content;
|
gint n_requested_content;
|
||||||
guint n_fetched_deltaparts;
|
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, "bytes-transferred", bytes_transferred);
|
||||||
ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time);
|
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. */
|
/* 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, "outstanding-metadata-fetches", pull_data->n_outstanding_metadata_fetches);
|
||||||
ostree_async_progress_set_uint (pull_data->progress, "metadata-fetched", pull_data->n_fetched_metadata);
|
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;
|
objtype = (OstreeObjectType)objtype_y;
|
||||||
checksum = ostree_checksum_from_bytes_v (csum_v);
|
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,
|
if (!ostree_repo_has_object (pull_data->repo, objtype, checksum,
|
||||||
&is_stored,
|
&is_stored,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
|
|
@ -1444,6 +1458,8 @@ process_one_static_delta (OtPullData *pull_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
n = g_variant_n_children (headers);
|
n = g_variant_n_children (headers);
|
||||||
|
pull_data->n_total_deltaparts += n;
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
const guchar *csum;
|
const guchar *csum;
|
||||||
|
|
@ -1463,6 +1479,8 @@ process_one_static_delta (OtPullData *pull_data,
|
||||||
if (!csum)
|
if (!csum)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
pull_data->total_deltapart_size += size;
|
||||||
|
|
||||||
if (!_ostree_repo_static_delta_part_have_all_objects (pull_data->repo,
|
if (!_ostree_repo_static_delta_part_have_all_objects (pull_data->repo,
|
||||||
objects,
|
objects,
|
||||||
&have_all,
|
&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",
|
g_debug ("Have all objects from static delta %s-%s part %u",
|
||||||
from_revision ? from_revision : "empty", to_revision,
|
from_revision ? from_revision : "empty", to_revision,
|
||||||
i);
|
i);
|
||||||
|
pull_data->n_fetched_deltaparts++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1803,7 +1822,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
goto out;
|
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)
|
if (is_mirror && !refs_to_fetch && !configured_branches)
|
||||||
{
|
{
|
||||||
|
|
@ -1963,6 +1982,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_debug ("processing delta superblock for %s-%s", from_revision ? from_revision : "empty", to_revision);
|
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,
|
if (!process_one_static_delta (pull_data, from_revision, to_revision,
|
||||||
delta_superblock,
|
delta_superblock,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
|
|
@ -2083,7 +2103,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
if (pull_data->base_uri)
|
if (pull_data->base_uri)
|
||||||
soup_uri_free (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->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->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->expected_commit_sizes, (GDestroyNotify) g_hash_table_unref);
|
||||||
g_clear_pointer (&pull_data->scanned_metadata, (GDestroyNotify) g_hash_table_unref);
|
g_clear_pointer (&pull_data->scanned_metadata, (GDestroyNotify) g_hash_table_unref);
|
||||||
|
|
|
||||||
|
|
@ -2767,6 +2767,8 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
|
||||||
guint outstanding_metadata_fetches;
|
guint outstanding_metadata_fetches;
|
||||||
guint outstanding_writes;
|
guint outstanding_writes;
|
||||||
guint n_scanned_metadata;
|
guint n_scanned_metadata;
|
||||||
|
guint fetched_delta_parts;
|
||||||
|
guint total_delta_parts;
|
||||||
|
|
||||||
if (!console)
|
if (!console)
|
||||||
return;
|
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_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches");
|
||||||
outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
|
outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
|
||||||
n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata");
|
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)
|
if (status)
|
||||||
{
|
{
|
||||||
g_string_append (buf, 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);
|
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",
|
g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s",
|
||||||
metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);
|
metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue