core: Add OstreeCommitSizesEntry type
This will be used when reading out entries in the `ostree.sizes` metadata. Each entry corresponds to an object in the metadata array.
This commit is contained in:
parent
1bbe674d91
commit
fcbb453443
|
|
@ -151,7 +151,13 @@ ostree_validate_structureof_dirmeta
|
||||||
ostree_commit_get_parent
|
ostree_commit_get_parent
|
||||||
ostree_commit_get_timestamp
|
ostree_commit_get_timestamp
|
||||||
ostree_commit_get_content_checksum
|
ostree_commit_get_content_checksum
|
||||||
|
OstreeCommitSizesEntry
|
||||||
|
ostree_commit_sizes_entry_new
|
||||||
|
ostree_commit_sizes_entry_copy
|
||||||
|
ostree_commit_sizes_entry_free
|
||||||
ostree_check_version
|
ostree_check_version
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
ostree_commit_sizes_entry_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
/* Add new symbols here. Release commits should copy this section into -released.sym. */
|
||||||
LIBOSTREE_2019.7 {
|
LIBOSTREE_2019.7 {
|
||||||
|
global:
|
||||||
|
ostree_commit_sizes_entry_copy;
|
||||||
|
ostree_commit_sizes_entry_free;
|
||||||
|
ostree_commit_sizes_entry_get_type;
|
||||||
|
ostree_commit_sizes_entry_new;
|
||||||
ostree_sysroot_initialize;
|
ostree_sysroot_initialize;
|
||||||
ostree_sysroot_is_booted;
|
ostree_sysroot_is_booted;
|
||||||
ostree_sysroot_set_mount_namespace_in_use;
|
ostree_sysroot_set_mount_namespace_in_use;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoDevInoCache, ostree_repo_devino_cache_u
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeAsyncProgress, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeAsyncProgress, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeBootconfigParser, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeBootconfigParser, g_object_unref)
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeCommitSizesEntry, ostree_commit_sizes_entry_free)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeDeployment, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeDeployment, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeGpgVerifyResult, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeGpgVerifyResult, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeKernelArgs, ostree_kernel_args_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeKernelArgs, ostree_kernel_args_free)
|
||||||
|
|
|
||||||
|
|
@ -2430,6 +2430,76 @@ ostree_commit_get_content_checksum (GVariant *commit_variant)
|
||||||
return g_strdup (hexdigest);
|
return g_strdup (hexdigest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_DEFINE_BOXED_TYPE (OstreeCommitSizesEntry, ostree_commit_sizes_entry,
|
||||||
|
ostree_commit_sizes_entry_copy, ostree_commit_sizes_entry_free)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_commit_sizes_entry_new:
|
||||||
|
* @checksum: (not nullable): object checksum
|
||||||
|
* @objtype: object type
|
||||||
|
* @unpacked: unpacked object size
|
||||||
|
* @archived: compressed object size
|
||||||
|
*
|
||||||
|
* Create a new #OstreeCommitSizesEntry for representing an object in a
|
||||||
|
* commit's "ostree.sizes" metadata.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full) (nullable): a new #OstreeCommitSizesEntry
|
||||||
|
* Since: 2019.7
|
||||||
|
*/
|
||||||
|
OstreeCommitSizesEntry *
|
||||||
|
ostree_commit_sizes_entry_new (const gchar *checksum,
|
||||||
|
OstreeObjectType objtype,
|
||||||
|
guint64 unpacked,
|
||||||
|
guint64 archived)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (checksum == NULL || ostree_validate_checksum_string (checksum, NULL), NULL);
|
||||||
|
|
||||||
|
g_autoptr(OstreeCommitSizesEntry) entry = g_new0 (OstreeCommitSizesEntry, 1);
|
||||||
|
entry->checksum = g_strdup (checksum);
|
||||||
|
entry->objtype = objtype;
|
||||||
|
entry->unpacked = unpacked;
|
||||||
|
entry->archived = archived;
|
||||||
|
|
||||||
|
return g_steal_pointer (&entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_commit_sizes_entry_copy:
|
||||||
|
* @entry: (not nullable): an #OstreeCommitSizesEntry
|
||||||
|
*
|
||||||
|
* Create a copy of the given @entry.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full) (nullable): a new copy of @entry
|
||||||
|
* Since: 2019.7
|
||||||
|
*/
|
||||||
|
OstreeCommitSizesEntry *
|
||||||
|
ostree_commit_sizes_entry_copy (const OstreeCommitSizesEntry *entry)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (entry != NULL, NULL);
|
||||||
|
|
||||||
|
return ostree_commit_sizes_entry_new (entry->checksum,
|
||||||
|
entry->objtype,
|
||||||
|
entry->unpacked,
|
||||||
|
entry->archived);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_commit_sizes_entry_free:
|
||||||
|
* @entry: (transfer full): an #OstreeCommitSizesEntry
|
||||||
|
*
|
||||||
|
* Free given @entry.
|
||||||
|
*
|
||||||
|
* Since: 2019.7
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ostree_commit_sizes_entry_free (OstreeCommitSizesEntry *entry)
|
||||||
|
{
|
||||||
|
g_return_if_fail (entry != NULL);
|
||||||
|
|
||||||
|
g_free (entry->checksum);
|
||||||
|
g_free (entry);
|
||||||
|
}
|
||||||
|
|
||||||
/* Used in pull/deploy to validate we're not being downgraded */
|
/* Used in pull/deploy to validate we're not being downgraded */
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_compare_timestamps (const char *current_rev,
|
_ostree_compare_timestamps (const char *current_rev,
|
||||||
|
|
|
||||||
|
|
@ -521,6 +521,38 @@ guint64 ostree_commit_get_timestamp (GVariant *commit_variant);
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
gchar * ostree_commit_get_content_checksum (GVariant *commit_variant);
|
gchar * ostree_commit_get_content_checksum (GVariant *commit_variant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OstreeCommitSizesEntry:
|
||||||
|
* @checksum: (not nullable): object checksum
|
||||||
|
* @objtype: object type
|
||||||
|
* @unpacked: unpacked object size
|
||||||
|
* @archived: compressed object size
|
||||||
|
*
|
||||||
|
* Structure representing an entry in the "ostree.sizes" commit metadata. Each
|
||||||
|
* entry corresponds to an object in the associated commit.
|
||||||
|
*
|
||||||
|
* Since: 2019.5
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
gchar *checksum;
|
||||||
|
OstreeObjectType objtype;
|
||||||
|
guint64 unpacked;
|
||||||
|
guint64 archived;
|
||||||
|
} OstreeCommitSizesEntry;
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
GType ostree_commit_sizes_entry_get_type (void);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
OstreeCommitSizesEntry *ostree_commit_sizes_entry_new (const gchar *checksum,
|
||||||
|
OstreeObjectType objtype,
|
||||||
|
guint64 unpacked,
|
||||||
|
guint64 archived);
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
OstreeCommitSizesEntry *ostree_commit_sizes_entry_copy (const OstreeCommitSizesEntry *entry);
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
void ostree_commit_sizes_entry_free (OstreeCommitSizesEntry *entry);
|
||||||
|
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
gboolean ostree_check_version (guint required_year, guint required_release);
|
gboolean ostree_check_version (guint required_year, guint required_release);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue