fetcher: Hoist core "mirrored request" API to public
This is in preparation for the libcurl port. We're basically making public what we had internally. The next step here is to create `ostree-fetcher-util.[ch]` that only operates in terms of this lower level API. Also drop the `_mirrored` from the function name since it's the default now. Closes: #636 Approved by: jlebon
This commit is contained in:
1 parent
eceb165013
commit
af560047a2
3 files changed
+87
-96
No files matched your search
@@ -707,8 +707,7 @@ content_fetch_on_complete (GObject *object,
|
||||
OstreeObjectType objtype;
|
||||
gboolean free_fetch_data = TRUE;
|
||||
|
||||
temp_path = _ostree_fetcher_mirrored_request_with_partial_finish (fetcher, result, error);
|
||||
if (!temp_path)
|
||||
if (!_ostree_fetcher_request_finish (fetcher, result, &temp_path, NULL, error))
|
||||
goto out;
|
||||
|
||||
ostree_object_name_deserialize (fetch_data->object, &checksum, &objtype);
|
||||
@@ -841,8 +840,7 @@ meta_fetch_on_complete (GObject *object,
|
||||
g_debug ("fetch of %s%s complete", checksum_obj,
|
||||
fetch_data->is_detached_meta ? " (detached)" : "");
|
||||
|
||||
temp_path = _ostree_fetcher_mirrored_request_with_partial_finish (fetcher, result, error);
|
||||
if (!temp_path)
|
||||
if (!_ostree_fetcher_request_finish (fetcher, result, &temp_path, NULL, error))
|
||||
{
|
||||
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
@@ -982,8 +980,7 @@ static_deltapart_fetch_on_complete (GObject *object,
|
||||
|
||||
g_debug ("fetch static delta part %s complete", fetch_data->expected_checksum);
|
||||
|
||||
temp_path = _ostree_fetcher_mirrored_request_with_partial_finish (fetcher, result, error);
|
||||
if (!temp_path)
|
||||
if (!_ostree_fetcher_request_finish (fetcher, result, &temp_path, NULL, error))
|
||||
goto out;
|
||||
|
||||
fd = openat (_ostree_fetcher_get_dfd (fetcher), temp_path, O_RDONLY | O_CLOEXEC);
|
||||
@@ -1382,12 +1379,13 @@ enqueue_one_object_request (OtPullData *pull_data,
|
||||
else
|
||||
expected_max_size = 0;
|
||||
|
||||
_ostree_fetcher_mirrored_request_with_partial_async (pull_data->fetcher, mirrorlist,
|
||||
obj_subpath, expected_max_size,
|
||||
is_meta ? OSTREE_REPO_PULL_METADATA_PRIORITY
|
||||
: OSTREE_REPO_PULL_CONTENT_PRIORITY,
|
||||
pull_data->cancellable,
|
||||
is_meta ? meta_fetch_on_complete : content_fetch_on_complete, fetch_data);
|
||||
_ostree_fetcher_request_async (pull_data->fetcher, mirrorlist,
|
||||
obj_subpath, OSTREE_FETCHER_REQUEST_FLAG_ENABLE_PARTIAL,
|
||||
expected_max_size,
|
||||
is_meta ? OSTREE_REPO_PULL_METADATA_PRIORITY
|
||||
: OSTREE_REPO_PULL_CONTENT_PRIORITY,
|
||||
pull_data->cancellable,
|
||||
is_meta ? meta_fetch_on_complete : content_fetch_on_complete, fetch_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1735,13 +1733,14 @@ process_one_static_delta (OtPullData *pull_data,
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostree_fetcher_mirrored_request_with_partial_async (pull_data->fetcher,
|
||||
pull_data->content_mirrorlist,
|
||||
deltapart_path, size,
|
||||
OSTREE_FETCHER_DEFAULT_PRIORITY,
|
||||
pull_data->cancellable,
|
||||
static_deltapart_fetch_on_complete,
|
||||
fetch_data);
|
||||
_ostree_fetcher_request_async (pull_data->fetcher,
|
||||
pull_data->content_mirrorlist,
|
||||
deltapart_path, OSTREE_FETCHER_REQUEST_FLAG_ENABLE_PARTIAL,
|
||||
size,
|
||||
OSTREE_FETCHER_DEFAULT_PRIORITY,
|
||||
pull_data->cancellable,
|
||||
static_deltapart_fetch_on_complete,
|
||||
fetch_data);
|
||||
pull_data->n_outstanding_deltapart_fetches++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user