repo: Rename "stage" to "write" in the API

An earlier version of this API acted like git in that some objects
would be staged in a temporary directory which would be then committed
in one go by moving files around. The API doesn't match most users
expectations though, as while the stage is nice as a high-level API
it isn't really suited for low-level APIs.

While the stage was removed, the APIs were never renamed. Rename
them now so that they match expectations.

https://bugzilla.gnome.org/show_bug.cgi?id=707644
This commit is contained in:
Jasper St. Pierre 2013-09-05 16:36:44 -04:00
parent c817217ad8
commit 5082e1d8e9
9 changed files with 134 additions and 134 deletions

View File

@ -68,14 +68,14 @@ ostree_repo_commit_transaction
ostree_repo_commit_transaction_with_stats
ostree_repo_abort_transaction
ostree_repo_has_object
ostree_repo_stage_metadata
ostree_repo_stage_metadata_async
ostree_repo_stage_metadata_finish
ostree_repo_stage_metadata_trusted
ostree_repo_stage_content
ostree_repo_stage_content_trusted
ostree_repo_stage_content_async
ostree_repo_stage_content_finish
ostree_repo_write_metadata
ostree_repo_write_metadata_async
ostree_repo_write_metadata_finish
ostree_repo_write_metadata_trusted
ostree_repo_write_content
ostree_repo_write_content_trusted
ostree_repo_write_content_async
ostree_repo_write_content_finish
ostree_repo_resolve_rev
ostree_repo_write_ref
ostree_repo_write_refspec
@ -92,10 +92,10 @@ OstreeRepoCommitModifier
ostree_repo_commit_modifier_new
ostree_repo_commit_modifier_ref
ostree_repo_commit_modifier_unref
ostree_repo_stage_directory_to_mtree
ostree_repo_stage_archive_to_mtree
ostree_repo_stage_mtree
ostree_repo_stage_commit
ostree_repo_write_directory_to_mtree
ostree_repo_write_archive_to_mtree
ostree_repo_write_mtree
ostree_repo_write_commit
OstreeRepoCheckoutMode
OstreeRepoCheckoutOverwriteMode
ostree_repo_checkout_tree

View File

@ -161,7 +161,7 @@ make_temporary_symlink (GFile *tmpdir,
}
static gboolean
stage_object (OstreeRepo *self,
write_object (OstreeRepo *self,
OstreeObjectType objtype,
const char *expected_checksum,
GInputStream *input,
@ -696,7 +696,7 @@ ostree_repo_abort_transaction (OstreeRepo *self,
}
/**
* ostree_repo_stage_metadata:
* ostree_repo_write_metadata:
* @self: Repo
* @objtype: Object type
* @expected_checksum: (allow-none): If provided, validate content against this checksum
@ -712,7 +712,7 @@ ostree_repo_abort_transaction (OstreeRepo *self,
* computed checksum.
*/
gboolean
ostree_repo_stage_metadata (OstreeRepo *self,
ostree_repo_write_metadata (OstreeRepo *self,
OstreeObjectType objtype,
const char *expected_checksum,
GVariant *object,
@ -726,12 +726,12 @@ ostree_repo_stage_metadata (OstreeRepo *self,
normalized = g_variant_get_normal_form (object);
input = ot_variant_read (normalized);
return stage_object (self, objtype, expected_checksum, input, 0, out_csum,
return write_object (self, objtype, expected_checksum, input, 0, out_csum,
cancellable, error);
}
/**
* ostree_repo_stage_metadata_trusted:
* ostree_repo_write_metadata_trusted:
* @self: Repo
* @objtype: Object type
* @checksum: Store object with this ASCII SHA256 checksum
@ -743,7 +743,7 @@ ostree_repo_stage_metadata (OstreeRepo *self,
* trusted.
*/
gboolean
ostree_repo_stage_metadata_trusted (OstreeRepo *self,
ostree_repo_write_metadata_trusted (OstreeRepo *self,
OstreeObjectType type,
const char *checksum,
GVariant *variant,
@ -756,7 +756,7 @@ ostree_repo_stage_metadata_trusted (OstreeRepo *self,
normalized = g_variant_get_normal_form (variant);
input = ot_variant_read (normalized);
return stage_object (self, type, checksum, input, 0, NULL,
return write_object (self, type, checksum, input, 0, NULL,
cancellable, error);
}
@ -769,12 +769,12 @@ typedef struct {
GSimpleAsyncResult *result;
guchar *result_csum;
} StageMetadataAsyncData;
} WriteMetadataAsyncData;
static void
stage_metadata_async_data_free (gpointer user_data)
write_metadata_async_data_free (gpointer user_data)
{
StageMetadataAsyncData *data = user_data;
WriteMetadataAsyncData *data = user_data;
g_clear_object (&data->repo);
g_clear_object (&data->cancellable);
@ -785,15 +785,15 @@ stage_metadata_async_data_free (gpointer user_data)
}
static void
stage_metadata_thread (GSimpleAsyncResult *res,
write_metadata_thread (GSimpleAsyncResult *res,
GObject *object,
GCancellable *cancellable)
{
GError *error = NULL;
StageMetadataAsyncData *data;
WriteMetadataAsyncData *data;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!ostree_repo_stage_metadata (data->repo, data->objtype, data->expected_checksum,
if (!ostree_repo_write_metadata (data->repo, data->objtype, data->expected_checksum,
data->object,
&data->result_csum,
cancellable, &error))
@ -801,20 +801,20 @@ stage_metadata_thread (GSimpleAsyncResult *res,
}
/**
* ostree_repo_stage_metadata_async:
* ostree_repo_write_metadata_async:
* @self: Repo
* @objtype: Object type
* @expected_checksum: (allow-none): If provided, validate content against this checksum
* @object: Metadata
* @cancellable: Cancellable
* @callback: Invoked when metadata is staged
* @callback: Invoked when metadata is writed
* @user_data: Data for @callback
*
* Asynchronously store the metadata object @variant. If provided,
* the checksum @expected_checksum will be verified.
*/
void
ostree_repo_stage_metadata_async (OstreeRepo *self,
ostree_repo_write_metadata_async (OstreeRepo *self,
OstreeObjectType objtype,
const char *expected_checksum,
GVariant *object,
@ -822,9 +822,9 @@ ostree_repo_stage_metadata_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
StageMetadataAsyncData *asyncdata;
WriteMetadataAsyncData *asyncdata;
asyncdata = g_new0 (StageMetadataAsyncData, 1);
asyncdata = g_new0 (WriteMetadataAsyncData, 1);
asyncdata->repo = g_object_ref (self);
asyncdata->objtype = objtype;
asyncdata->expected_checksum = g_strdup (expected_checksum);
@ -833,24 +833,24 @@ ostree_repo_stage_metadata_async (OstreeRepo *self,
asyncdata->result = g_simple_async_result_new ((GObject*) self,
callback, user_data,
ostree_repo_stage_metadata_async);
ostree_repo_write_metadata_async);
g_simple_async_result_set_op_res_gpointer (asyncdata->result, asyncdata,
stage_metadata_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, stage_metadata_thread, G_PRIORITY_DEFAULT, cancellable);
write_metadata_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, write_metadata_thread, G_PRIORITY_DEFAULT, cancellable);
g_object_unref (asyncdata->result);
}
gboolean
ostree_repo_stage_metadata_finish (OstreeRepo *self,
ostree_repo_write_metadata_finish (OstreeRepo *self,
GAsyncResult *result,
guchar **out_csum,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
StageMetadataAsyncData *data;
WriteMetadataAsyncData *data;
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_stage_metadata_async);
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_write_metadata_async);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
@ -863,7 +863,7 @@ ostree_repo_stage_metadata_finish (OstreeRepo *self,
}
gboolean
_ostree_repo_stage_directory_meta (OstreeRepo *self,
_ostree_repo_write_directory_meta (OstreeRepo *self,
GFileInfo *file_info,
GVariant *xattrs,
guchar **out_csum,
@ -877,7 +877,7 @@ _ostree_repo_stage_directory_meta (OstreeRepo *self,
dirmeta = ostree_create_directory_metadata (file_info, xattrs);
return ostree_repo_stage_metadata (self, OSTREE_OBJECT_TYPE_DIR_META, NULL,
return ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_DIR_META, NULL,
dirmeta, out_csum, cancellable, error);
}
@ -914,7 +914,7 @@ _ostree_repo_get_uncompressed_object_cache_path (OstreeRepo *self,
}
/**
* ostree_repo_stage_content_trusted:
* ostree_repo_write_content_trusted:
* @self: Repo
* @checksum: Store content using this ASCII SHA256 checksum
* @object_input: Content stream
@ -929,20 +929,20 @@ _ostree_repo_get_uncompressed_object_cache_path (OstreeRepo *self,
* disk, for example.
*/
gboolean
ostree_repo_stage_content_trusted (OstreeRepo *self,
ostree_repo_write_content_trusted (OstreeRepo *self,
const char *checksum,
GInputStream *object_input,
guint64 length,
GCancellable *cancellable,
GError **error)
{
return stage_object (self, OSTREE_OBJECT_TYPE_FILE, checksum,
return write_object (self, OSTREE_OBJECT_TYPE_FILE, checksum,
object_input, length, NULL,
cancellable, error);
}
/**
* ostree_repo_stage_content:
* ostree_repo_write_content:
* @self: Repo
* @expected_checksum: (allow-none): If provided, validate content against this checksum
* @object_input: Content object stream
@ -956,7 +956,7 @@ ostree_repo_stage_content_trusted (OstreeRepo *self,
* be returned as @out_csum.
*/
gboolean
ostree_repo_stage_content (OstreeRepo *self,
ostree_repo_write_content (OstreeRepo *self,
const char *expected_checksum,
GInputStream *object_input,
guint64 length,
@ -964,7 +964,7 @@ ostree_repo_stage_content (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
return stage_object (self, OSTREE_OBJECT_TYPE_FILE, expected_checksum,
return write_object (self, OSTREE_OBJECT_TYPE_FILE, expected_checksum,
object_input, length, out_csum,
cancellable, error);
}
@ -978,12 +978,12 @@ typedef struct {
GSimpleAsyncResult *result;
guchar *result_csum;
} StageContentAsyncData;
} WriteContentAsyncData;
static void
stage_content_async_data_free (gpointer user_data)
write_content_async_data_free (gpointer user_data)
{
StageContentAsyncData *data = user_data;
WriteContentAsyncData *data = user_data;
g_clear_object (&data->repo);
g_clear_object (&data->cancellable);
@ -994,15 +994,15 @@ stage_content_async_data_free (gpointer user_data)
}
static void
stage_content_thread (GSimpleAsyncResult *res,
write_content_thread (GSimpleAsyncResult *res,
GObject *object,
GCancellable *cancellable)
{
GError *error = NULL;
StageContentAsyncData *data;
WriteContentAsyncData *data;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!ostree_repo_stage_content (data->repo, data->expected_checksum,
if (!ostree_repo_write_content (data->repo, data->expected_checksum,
data->object, data->file_object_length,
&data->result_csum,
cancellable, &error))
@ -1010,20 +1010,20 @@ stage_content_thread (GSimpleAsyncResult *res,
}
/**
* ostree_repo_stage_content_async:
* ostree_repo_write_content_async:
* @self: Repo
* @expected_checksum: (allow-none): If provided, validate content against this checksum
* @object: Input
* @length: Length of @object
* @cancellable: Cancellable
* @callback: Invoked when content is staged
* @callback: Invoked when content is writed
* @user_data: User data for @callback
*
* Asynchronously store the content object @object. If provided, the
* checksum @expected_checksum will be verified.
*/
void
ostree_repo_stage_content_async (OstreeRepo *self,
ostree_repo_write_content_async (OstreeRepo *self,
const char *expected_checksum,
GInputStream *object,
guint64 length,
@ -1031,9 +1031,9 @@ ostree_repo_stage_content_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
StageContentAsyncData *asyncdata;
WriteContentAsyncData *asyncdata;
asyncdata = g_new0 (StageContentAsyncData, 1);
asyncdata = g_new0 (WriteContentAsyncData, 1);
asyncdata->repo = g_object_ref (self);
asyncdata->expected_checksum = g_strdup (expected_checksum);
asyncdata->object = g_object_ref (object);
@ -1042,33 +1042,33 @@ ostree_repo_stage_content_async (OstreeRepo *self,
asyncdata->result = g_simple_async_result_new ((GObject*) self,
callback, user_data,
ostree_repo_stage_content_async);
ostree_repo_write_content_async);
g_simple_async_result_set_op_res_gpointer (asyncdata->result, asyncdata,
stage_content_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, stage_content_thread, G_PRIORITY_DEFAULT, cancellable);
write_content_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, write_content_thread, G_PRIORITY_DEFAULT, cancellable);
g_object_unref (asyncdata->result);
}
/**
* ostree_repo_stage_content_finish:
* ostree_repo_write_content_finish:
* @self: a #OstreeRepo
* @result: a #GAsyncResult
* @out_csum: (out) (transfer full): A binary SHA256 checksum of the content object
* @error: a #GError
*
* Completes an invocation of ostree_repo_stage_content_async().
* Completes an invocation of ostree_repo_write_content_async().
*/
gboolean
ostree_repo_stage_content_finish (OstreeRepo *self,
ostree_repo_write_content_finish (OstreeRepo *self,
GAsyncResult *result,
guchar **out_csum,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
StageContentAsyncData *data;
WriteContentAsyncData *data;
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_stage_content_async);
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_write_content_async);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
@ -1087,7 +1087,7 @@ create_empty_gvariant_dict (void)
}
/**
* ostree_repo_stage_commit:
* ostree_repo_write_commit:
* @self: Repo
* @branch: Name of ref
* @parent: (allow-none): ASCII SHA256 checksum for parent, or %NULL for none
@ -1103,7 +1103,7 @@ create_empty_gvariant_dict (void)
* and @root_metadata_checksum.
*/
gboolean
ostree_repo_stage_commit (OstreeRepo *self,
ostree_repo_write_commit (OstreeRepo *self,
const char *branch,
const char *parent,
const char *subject,
@ -1135,7 +1135,7 @@ ostree_repo_stage_commit (OstreeRepo *self,
ostree_checksum_to_bytes_v (root_contents_checksum),
ostree_checksum_to_bytes_v (root_metadata_checksum));
g_variant_ref_sink (commit);
if (!ostree_repo_stage_metadata (self, OSTREE_OBJECT_TYPE_COMMIT, NULL,
if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_COMMIT, NULL,
commit, &commit_csum,
cancellable, error))
goto out;
@ -1274,7 +1274,7 @@ apply_commit_filter (OstreeRepo *self,
}
static gboolean
stage_directory_to_mtree_internal (OstreeRepo *self,
write_directory_to_mtree_internal (OstreeRepo *self,
GFile *dir,
OstreeMutableTree *mtree,
OstreeRepoCommitModifier *modifier,
@ -1331,7 +1331,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
goto out;
}
if (!_ostree_repo_stage_directory_meta (self, modified_info, xattrs, &child_file_csum,
if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum,
cancellable, error))
goto out;
@ -1379,7 +1379,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
if (!ostree_mutable_tree_ensure_dir (mtree, name, &child_mtree, error))
goto out;
if (!stage_directory_to_mtree_internal (self, child, child_mtree,
if (!write_directory_to_mtree_internal (self, child, child_mtree,
modifier, path,
cancellable, error))
goto out;
@ -1432,7 +1432,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
&file_object_input, &file_obj_length,
cancellable, error))
goto out;
if (!ostree_repo_stage_content (self, NULL, file_object_input, file_obj_length,
if (!ostree_repo_write_content (self, NULL, file_object_input, file_obj_length,
&child_file_csum, cancellable, error))
goto out;
@ -1458,7 +1458,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
}
/**
* ostree_repo_stage_directory_to_mtree:
* ostree_repo_write_directory_to_mtree:
* @self: Repo
* @dir: Path to a directory
* @mtree: Overlay directory contents into this tree
@ -1470,7 +1470,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
* overlaying the resulting filesystem hierarchy into @mtree.
*/
gboolean
ostree_repo_stage_directory_to_mtree (OstreeRepo *self,
ostree_repo_write_directory_to_mtree (OstreeRepo *self,
GFile *dir,
OstreeMutableTree *mtree,
OstreeRepoCommitModifier *modifier,
@ -1481,7 +1481,7 @@ ostree_repo_stage_directory_to_mtree (OstreeRepo *self,
GPtrArray *path = NULL;
path = g_ptr_array_new ();
if (!stage_directory_to_mtree_internal (self, dir, mtree, modifier, path,
if (!write_directory_to_mtree_internal (self, dir, mtree, modifier, path,
cancellable, error))
goto out;
@ -1493,7 +1493,7 @@ ostree_repo_stage_directory_to_mtree (OstreeRepo *self,
}
/**
* ostree_repo_stage_mtree:
* ostree_repo_write_mtree:
* @self: Repo
* @mtree: Mutable tree
* @out_contents_checksum: (out): Return location for ASCII checksum
@ -1505,7 +1505,7 @@ ostree_repo_stage_directory_to_mtree (OstreeRepo *self,
* %OSTREE_OBJECT_TYPE_DIR_TREE object.
*/
gboolean
ostree_repo_stage_mtree (OstreeRepo *self,
ostree_repo_write_mtree (OstreeRepo *self,
OstreeMutableTree *mtree,
char **out_contents_checksum,
GCancellable *cancellable,
@ -1541,7 +1541,7 @@ ostree_repo_stage_mtree (OstreeRepo *self,
OstreeMutableTree *child_dir = value;
char *child_dir_contents_checksum;
if (!ostree_repo_stage_mtree (self, child_dir, &child_dir_contents_checksum,
if (!ostree_repo_write_mtree (self, child_dir, &child_dir_contents_checksum,
cancellable, error))
goto out;
@ -1558,7 +1558,7 @@ ostree_repo_stage_mtree (OstreeRepo *self,
dir_contents_checksums,
dir_metadata_checksums);
if (!ostree_repo_stage_metadata (self, OSTREE_OBJECT_TYPE_DIR_TREE, NULL,
if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_DIR_TREE, NULL,
serialized_tree, &contents_csum,
cancellable, error))
goto out;

View File

@ -119,7 +119,7 @@ import_libarchive_entry_file (OstreeRepo *self,
&file_object_input, &length, cancellable, error))
goto out;
if (!ostree_repo_stage_content (self, NULL, file_object_input, length, out_csum,
if (!ostree_repo_write_content (self, NULL, file_object_input, length, out_csum,
cancellable, error))
goto out;
@ -129,7 +129,7 @@ import_libarchive_entry_file (OstreeRepo *self,
}
static gboolean
stage_libarchive_entry_to_mtree (OstreeRepo *self,
write_libarchive_entry_to_mtree (OstreeRepo *self,
OstreeMutableTree *root,
struct archive *a,
struct archive_entry *entry,
@ -242,7 +242,7 @@ stage_libarchive_entry_to_mtree (OstreeRepo *self,
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
{
if (!_ostree_repo_stage_directory_meta (self, file_info, NULL, &tmp_csum, cancellable, error))
if (!_ostree_repo_write_directory_meta (self, file_info, NULL, &tmp_csum, cancellable, error))
goto out;
if (parent == NULL)
@ -288,7 +288,7 @@ stage_libarchive_entry_to_mtree (OstreeRepo *self,
#endif
gboolean
ostree_repo_stage_archive_to_mtree (OstreeRepo *self,
ostree_repo_write_archive_to_mtree (OstreeRepo *self,
GFile *archive_f,
OstreeMutableTree *root,
OstreeRepoCommitModifier *modifier,
@ -336,11 +336,11 @@ ostree_repo_stage_archive_to_mtree (OstreeRepo *self,
g_file_info_set_attribute_uint32 (tmp_dir_info, "unix::gid", archive_entry_gid (entry));
g_file_info_set_attribute_uint32 (tmp_dir_info, "unix::mode", 0755 | S_IFDIR);
if (!_ostree_repo_stage_directory_meta (self, tmp_dir_info, NULL, &tmp_csum, cancellable, error))
if (!_ostree_repo_write_directory_meta (self, tmp_dir_info, NULL, &tmp_csum, cancellable, error))
goto out;
}
if (!stage_libarchive_entry_to_mtree (self, root, a,
if (!write_libarchive_entry_to_mtree (self, root, a,
entry, modifier,
autocreate_parents ? tmp_csum : NULL,
cancellable, error))

View File

@ -90,7 +90,7 @@ _ostree_repo_get_object_path (OstreeRepo *self,
OstreeObjectType type);
gboolean
_ostree_repo_stage_directory_meta (OstreeRepo *self,
_ostree_repo_write_directory_meta (OstreeRepo *self,
GFileInfo *file_info,
GVariant *xattrs,
guchar **out_csum,

View File

@ -101,9 +101,9 @@ typedef struct {
guint metadata_scan_idle : 1; /* TRUE if we passed through an idle message */
guint idle_serial; /* Incremented when we get a SCAN_IDLE message */
guint n_outstanding_metadata_fetches;
guint n_outstanding_metadata_stage_requests;
guint n_outstanding_metadata_write_requests;
guint n_outstanding_content_fetches;
guint n_outstanding_content_stage_requests;
guint n_outstanding_content_write_requests;
gint n_requested_metadata;
gint n_requested_content;
guint n_fetched_metadata;
@ -178,13 +178,13 @@ uri_fetch_update_status (gpointer user_data)
{
OtPullData *pull_data = user_data;
GString *status;
guint outstanding_stages;
guint outstanding_writes;
guint outstanding_fetches;
status = g_string_new ("");
outstanding_fetches = pull_data->n_outstanding_content_fetches + pull_data->n_outstanding_metadata_fetches;
outstanding_stages = pull_data->n_outstanding_content_stage_requests + pull_data->n_outstanding_metadata_stage_requests;
outstanding_writes = pull_data->n_outstanding_content_write_requests + pull_data->n_outstanding_metadata_write_requests;
if (pull_data->fetching_sync_uri)
{
@ -204,8 +204,8 @@ uri_fetch_update_status (gpointer user_data)
(guint)((((double)fetched) / requested) * 100),
fetched, requested, formatted_bytes_transferred);
}
else if (outstanding_stages > 0)
g_string_append_printf (status, "Writing objects: %u", outstanding_stages);
else if (outstanding_writes > 0)
g_string_append_printf (status, "Writing objects: %u", outstanding_writes);
else if (!pull_data->metadata_scan_idle)
g_string_append_printf (status, "Scanning metadata: %u",
g_atomic_int_get (&pull_data->n_scanned_metadata));
@ -265,11 +265,11 @@ check_outstanding_requests_handle_error (OtPullData *pull_data,
{
gboolean current_fetch_idle = (pull_data->n_outstanding_metadata_fetches == 0 &&
pull_data->n_outstanding_content_fetches == 0);
gboolean current_stage_idle = (pull_data->n_outstanding_metadata_stage_requests == 0 &&
pull_data->n_outstanding_content_stage_requests == 0);
gboolean current_write_idle = (pull_data->n_outstanding_metadata_write_requests == 0 &&
pull_data->n_outstanding_content_write_requests == 0);
g_debug ("pull: scan: %u fetching: %u staging: %u",
!pull_data->metadata_scan_idle, !current_fetch_idle, !current_stage_idle);
!pull_data->metadata_scan_idle, !current_fetch_idle, !current_write_idle);
throw_async_error (pull_data, error);
@ -280,7 +280,7 @@ check_outstanding_requests_handle_error (OtPullData *pull_data,
g_main_loop_quit (pull_data->loop);
return;
}
else if (pull_data->metadata_scan_idle && current_fetch_idle && current_stage_idle)
else if (pull_data->metadata_scan_idle && current_fetch_idle && current_write_idle)
{
g_main_loop_quit (pull_data->loop);
}
@ -516,7 +516,7 @@ fetch_ref_contents (OtPullData *pull_data,
}
static void
content_fetch_on_stage_complete (GObject *object,
content_fetch_on_write_complete (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@ -529,7 +529,7 @@ content_fetch_on_stage_complete (GObject *object,
gs_free guchar *csum = NULL;
gs_free char *checksum = NULL;
if (!ostree_repo_stage_content_finish ((OstreeRepo*)object, result,
if (!ostree_repo_write_content_finish ((OstreeRepo*)object, result,
&csum, error))
goto out;
@ -538,7 +538,7 @@ content_fetch_on_stage_complete (GObject *object,
ostree_object_name_deserialize (fetch_data->object, &expected_checksum, &objtype);
g_assert (objtype == OSTREE_OBJECT_TYPE_FILE);
g_debug ("stage of %s complete", ostree_object_to_string (checksum, objtype));
g_debug ("write of %s complete", ostree_object_to_string (checksum, objtype));
if (strcmp (checksum, expected_checksum) != 0)
{
@ -550,7 +550,7 @@ content_fetch_on_stage_complete (GObject *object,
pull_data->n_fetched_content++;
out:
pull_data->n_outstanding_content_stage_requests--;
pull_data->n_outstanding_content_write_requests--;
check_outstanding_requests_handle_error (pull_data, local_error);
(void) gs_file_unlink (fetch_data->temp_path, NULL, NULL);
g_object_unref (fetch_data->temp_path);
@ -595,11 +595,11 @@ content_fetch_on_complete (GObject *object,
cancellable, error))
goto out;
pull_data->n_outstanding_content_stage_requests++;
ostree_repo_stage_content_async (pull_data->repo, checksum,
pull_data->n_outstanding_content_write_requests++;
ostree_repo_write_content_async (pull_data->repo, checksum,
object_input, length,
cancellable,
content_fetch_on_stage_complete, fetch_data);
content_fetch_on_write_complete, fetch_data);
out:
pull_data->n_outstanding_content_fetches--;
@ -607,7 +607,7 @@ content_fetch_on_complete (GObject *object,
}
static void
on_metadata_staged (GObject *object,
on_metadata_writed (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@ -620,7 +620,7 @@ on_metadata_staged (GObject *object,
gs_free char *checksum = NULL;
gs_free guchar *csum = NULL;
if (!ostree_repo_stage_metadata_finish ((OstreeRepo*)object, result,
if (!ostree_repo_write_metadata_finish ((OstreeRepo*)object, result,
&csum, error))
goto out;
@ -629,7 +629,7 @@ on_metadata_staged (GObject *object,
ostree_object_name_deserialize (fetch_data->object, &expected_checksum, &objtype);
g_assert (OSTREE_OBJECT_TYPE_IS_META (objtype));
g_debug ("stage of %s complete", ostree_object_to_string (checksum, objtype));
g_debug ("write of %s complete", ostree_object_to_string (checksum, objtype));
if (strcmp (checksum, expected_checksum) != 0)
{
@ -644,7 +644,7 @@ on_metadata_staged (GObject *object,
pull_worker_message_new (PULL_MSG_SCAN,
g_variant_ref (fetch_data->object)));
out:
pull_data->n_outstanding_metadata_stage_requests--;
pull_data->n_outstanding_metadata_write_requests--;
(void) gs_file_unlink (fetch_data->temp_path, NULL, NULL);
g_object_unref (fetch_data->temp_path);
g_variant_unref (fetch_data->object);
@ -678,11 +678,11 @@ meta_fetch_on_complete (GObject *object,
FALSE, &metadata, error))
goto out;
ostree_repo_stage_metadata_async (pull_data->repo, objtype, checksum, metadata,
ostree_repo_write_metadata_async (pull_data->repo, objtype, checksum, metadata,
pull_data->cancellable,
on_metadata_staged, fetch_data);
on_metadata_writed, fetch_data);
pull_data->n_outstanding_metadata_stage_requests++;
pull_data->n_outstanding_metadata_write_requests++;
out:
pull_data->n_outstanding_metadata_fetches--;
pull_data->n_fetched_metadata++;

View File

@ -54,12 +54,12 @@
* To store content in the repo, first start a transaction with
* ostree_repo_prepare_transaction(). Then create a
* #OstreeMutableTree, and apply functions such as
* ostree_repo_stage_directory_to_mtree() to traverse a physical
* filesystem and stage content, possibly multiple times.
* ostree_repo_write_directory_to_mtree() to traverse a physical
* filesystem and write content, possibly multiple times.
*
* Once the #OstreeMutableTree is complete, stage all of its metadata
* with ostree_repo_stage_mtree(), and finally create a commit with
* ostree_repo_stage_commit().
* Once the #OstreeMutableTree is complete, write all of its metadata
* with ostree_repo_write_mtree(), and finally create a commit with
* ostree_repo_write_commit().
*/
typedef struct {
GObjectClass parent_class;

View File

@ -109,7 +109,7 @@ gboolean ostree_repo_has_object (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_metadata (OstreeRepo *self,
gboolean ostree_repo_write_metadata (OstreeRepo *self,
OstreeObjectType objtype,
const char *expected_checksum,
GVariant *object,
@ -117,7 +117,7 @@ gboolean ostree_repo_stage_metadata (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
void ostree_repo_stage_metadata_async (OstreeRepo *self,
void ostree_repo_write_metadata_async (OstreeRepo *self,
OstreeObjectType objtype,
const char *expected_checksum,
GVariant *object,
@ -125,12 +125,12 @@ void ostree_repo_stage_metadata_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean ostree_repo_stage_metadata_finish (OstreeRepo *self,
gboolean ostree_repo_write_metadata_finish (OstreeRepo *self,
GAsyncResult *result,
guchar **out_csum,
GError **error);
gboolean ostree_repo_stage_content (OstreeRepo *self,
gboolean ostree_repo_write_content (OstreeRepo *self,
const char *expected_checksum,
GInputStream *object_input,
guint64 length,
@ -138,21 +138,21 @@ gboolean ostree_repo_stage_content (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_metadata_trusted (OstreeRepo *self,
gboolean ostree_repo_write_metadata_trusted (OstreeRepo *self,
OstreeObjectType objtype,
const char *checksum,
GVariant *variant,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_content_trusted (OstreeRepo *self,
gboolean ostree_repo_write_content_trusted (OstreeRepo *self,
const char *checksum,
GInputStream *object_input,
guint64 length,
GCancellable *cancellable,
GError **error);
void ostree_repo_stage_content_async (OstreeRepo *self,
void ostree_repo_write_content_async (OstreeRepo *self,
const char *expected_checksum,
GInputStream *object,
guint64 length,
@ -160,7 +160,7 @@ void ostree_repo_stage_content_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean ostree_repo_stage_content_finish (OstreeRepo *self,
gboolean ostree_repo_write_content_finish (OstreeRepo *self,
GAsyncResult *result,
guchar **out_csum,
GError **error);
@ -280,14 +280,14 @@ GType ostree_repo_commit_modifier_get_type (void);
OstreeRepoCommitModifier *ostree_repo_commit_modifier_ref (OstreeRepoCommitModifier *modifier);
void ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier);
gboolean ostree_repo_stage_directory_to_mtree (OstreeRepo *self,
gboolean ostree_repo_write_directory_to_mtree (OstreeRepo *self,
GFile *dir,
OstreeMutableTree *mtree,
OstreeRepoCommitModifier *modifier,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_archive_to_mtree (OstreeRepo *self,
gboolean ostree_repo_write_archive_to_mtree (OstreeRepo *self,
GFile *archive,
OstreeMutableTree *tree,
OstreeRepoCommitModifier *modifier,
@ -295,13 +295,13 @@ gboolean ostree_repo_stage_archive_to_mtree (OstreeRepo *
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_mtree (OstreeRepo *self,
gboolean ostree_repo_write_mtree (OstreeRepo *self,
OstreeMutableTree *mtree,
char **out_contents_checksum,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_stage_commit (OstreeRepo *self,
gboolean ostree_repo_write_commit (OstreeRepo *self,
const char *branch,
const char *parent,
const char *subject,

View File

@ -308,7 +308,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
arg = g_file_new_for_path (current_dir);
g_free (current_dir);
if (!ostree_repo_stage_directory_to_mtree (repo, arg, mtree, modifier,
if (!ostree_repo_write_directory_to_mtree (repo, arg, mtree, modifier,
cancellable, error))
goto out;
}
@ -337,14 +337,14 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
if (strcmp (tree_type, "dir") == 0)
{
arg = g_file_new_for_path (tree);
if (!ostree_repo_stage_directory_to_mtree (repo, arg, mtree, modifier,
if (!ostree_repo_write_directory_to_mtree (repo, arg, mtree, modifier,
cancellable, error))
goto out;
}
else if (strcmp (tree_type, "tar") == 0)
{
arg = g_file_new_for_path (tree);
if (!ostree_repo_stage_archive_to_mtree (repo, arg, mtree, modifier,
if (!ostree_repo_write_archive_to_mtree (repo, arg, mtree, modifier,
opt_tar_autocreate_parents,
cancellable, error))
goto out;
@ -354,7 +354,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
if (!ostree_repo_read_commit (repo, tree, &arg, cancellable, error))
goto out;
if (!ostree_repo_stage_directory_to_mtree (repo, arg, mtree, modifier,
if (!ostree_repo_write_directory_to_mtree (repo, arg, mtree, modifier,
cancellable, error))
goto out;
}
@ -370,7 +370,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
{
g_assert (argc > 1);
arg = g_file_new_for_path (argv[1]);
if (!ostree_repo_stage_directory_to_mtree (repo, arg, mtree, modifier,
if (!ostree_repo_write_directory_to_mtree (repo, arg, mtree, modifier,
cancellable, error))
goto out;
}
@ -391,7 +391,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
goto out;
}
if (!ostree_repo_stage_mtree (repo, mtree, &contents_checksum, cancellable, error))
if (!ostree_repo_write_mtree (repo, mtree, &contents_checksum, cancellable, error))
goto out;
if (opt_skip_if_unchanged && parent_commit)
@ -419,7 +419,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
goto out;
}
if (!ostree_repo_stage_commit (repo, opt_branch, parent, opt_subject, opt_body,
if (!ostree_repo_write_commit (repo, opt_branch, parent, opt_subject, opt_body,
contents_checksum, root_metadata,
&commit_checksum, cancellable, error))
goto out;

View File

@ -72,7 +72,7 @@ import_one_object (OtLocalCloneData *data,
cancellable, error))
goto out;
if (!ostree_repo_stage_content_trusted (data->dest_repo, checksum,
if (!ostree_repo_write_content_trusted (data->dest_repo, checksum,
file_object, length,
cancellable, error))
goto out;
@ -85,7 +85,7 @@ import_one_object (OtLocalCloneData *data,
error))
goto out;
if (!ostree_repo_stage_metadata_trusted (data->dest_repo, objtype, checksum, metadata,
if (!ostree_repo_write_metadata_trusted (data->dest_repo, objtype, checksum, metadata,
cancellable, error))
goto out;
}