mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-09 01:18:35 +03:00
deltas: Add ostree_repo_list_static_delta_indexes() function
This lists all the available delta indexes.
This commit is contained in:
parent
87e564eeaa
commit
8e1f199dd4
@ -184,9 +184,9 @@ libostree_1_la_SOURCES += \
|
|||||||
endif # USE_GPGME
|
endif # USE_GPGME
|
||||||
|
|
||||||
symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym
|
symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym
|
||||||
#if BUILDOPT_IS_DEVEL_BUILD
|
if BUILDOPT_IS_DEVEL_BUILD
|
||||||
#symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym
|
symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym
|
||||||
#endif
|
endif
|
||||||
# http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html
|
# http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html
|
||||||
wl_versionscript_arg = -Wl,--version-script=
|
wl_versionscript_arg = -Wl,--version-script=
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
|
@ -412,6 +412,7 @@ OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE
|
|||||||
ostree_repo_list_objects
|
ostree_repo_list_objects
|
||||||
ostree_repo_list_commit_objects_starting_with
|
ostree_repo_list_commit_objects_starting_with
|
||||||
ostree_repo_list_static_delta_names
|
ostree_repo_list_static_delta_names
|
||||||
|
ostree_repo_list_static_delta_indexes
|
||||||
OstreeStaticDeltaGenerateOpt
|
OstreeStaticDeltaGenerateOpt
|
||||||
ostree_repo_static_delta_generate
|
ostree_repo_static_delta_generate
|
||||||
ostree_repo_static_delta_execute_offline_with_signature
|
ostree_repo_static_delta_execute_offline_with_signature
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
/* Copy the bits below and uncomment the include in Makefile-libostree.am
|
LIBOSTREE_2020.8 {
|
||||||
when adding a symbol.
|
global:
|
||||||
*/
|
ostree_repo_list_static_delta_indexes;
|
||||||
|
} LIBOSTREE_2020.7;
|
||||||
|
|
||||||
/* Stub section for the stable release *after* this development one; don't
|
/* Stub section for the stable release *after* this development one; don't
|
||||||
* edit this other than to update the year. This is just a copy/paste
|
* edit this other than to update the year. This is just a copy/paste
|
||||||
|
@ -168,6 +168,93 @@ ostree_repo_list_static_delta_names (OstreeRepo *self,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_list_static_delta_indexes:
|
||||||
|
* @self: Repo
|
||||||
|
* @out_indexes: (out) (element-type utf8) (transfer container): String name of delta indexes (checksum)
|
||||||
|
* @cancellable: Cancellable
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* This function synchronously enumerates all static delta indexes in the
|
||||||
|
* repository, returning its result in @out_indexes.
|
||||||
|
*
|
||||||
|
* Since: 2020.7
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
ostree_repo_list_static_delta_indexes (OstreeRepo *self,
|
||||||
|
GPtrArray **out_indexes,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(GPtrArray) ret_indexes = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
|
||||||
|
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||||
|
gboolean exists;
|
||||||
|
if (!ot_dfd_iter_init_allow_noent (self->repo_dir_fd, "delta-indexes", &dfd_iter,
|
||||||
|
&exists, error))
|
||||||
|
return FALSE;
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
/* Note early return */
|
||||||
|
ot_transfer_out_value (out_indexes, &ret_indexes);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
g_auto(GLnxDirFdIterator) sub_dfd_iter = { 0, };
|
||||||
|
struct dirent *dent;
|
||||||
|
|
||||||
|
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent, cancellable, error))
|
||||||
|
return FALSE;
|
||||||
|
if (dent == NULL)
|
||||||
|
break;
|
||||||
|
if (dent->d_type != DT_DIR)
|
||||||
|
continue;
|
||||||
|
if (strlen (dent->d_name) != 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!glnx_dirfd_iterator_init_at (dfd_iter.fd, dent->d_name, FALSE,
|
||||||
|
&sub_dfd_iter, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
struct dirent *sub_dent;
|
||||||
|
|
||||||
|
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&sub_dfd_iter, &sub_dent,
|
||||||
|
cancellable, error))
|
||||||
|
return FALSE;
|
||||||
|
if (sub_dent == NULL)
|
||||||
|
break;
|
||||||
|
if (sub_dent->d_type != DT_REG)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const char *name1 = dent->d_name;
|
||||||
|
const char *name2 = sub_dent->d_name;
|
||||||
|
|
||||||
|
/* base64 len is 43, but 2 chars are in the parent dir name */
|
||||||
|
if (strlen (name2) != 41 + strlen(".index") ||
|
||||||
|
!g_str_has_suffix (name2, ".index"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_autoptr(GString) out = g_string_new (name1);
|
||||||
|
g_string_append_len (out, name2, 41);
|
||||||
|
|
||||||
|
char checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||||
|
guchar csum[OSTREE_SHA256_DIGEST_LEN];
|
||||||
|
|
||||||
|
ostree_checksum_b64_inplace_to_bytes (out->str, csum);
|
||||||
|
ostree_checksum_inplace_from_bytes (csum, checksum);
|
||||||
|
|
||||||
|
g_ptr_array_add (ret_indexes, g_strdup (checksum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ot_transfer_out_value (out_indexes, &ret_indexes);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo,
|
_ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo,
|
||||||
GVariant *checksum_array,
|
GVariant *checksum_array,
|
||||||
|
@ -1046,6 +1046,12 @@ gboolean ostree_repo_list_static_delta_names (OstreeRepo *self,
|
|||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
gboolean ostree_repo_list_static_delta_indexes (OstreeRepo *self,
|
||||||
|
GPtrArray **out_indexes,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OstreeStaticDeltaGenerateOpt:
|
* OstreeStaticDeltaGenerateOpt:
|
||||||
* @OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY: Optimize for speed of delta creation over space
|
* @OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY: Optimize for speed of delta creation over space
|
||||||
|
Loading…
Reference in New Issue
Block a user