deltas: Make ostree_repo_static_delta_reindex() public

It is useful to be able to trigger this without having to regenerate
the summary. For example, if you are not using summaries, or ar generating
the summaries yourself.
This commit is contained in:
Alexander Larsson 2020-10-12 15:57:53 +02:00
parent 024ef1d756
commit c304703e1d
5 changed files with 42 additions and 5 deletions

View File

@ -413,6 +413,7 @@ ostree_repo_list_objects
ostree_repo_list_commit_objects_starting_with
ostree_repo_list_static_delta_names
ostree_repo_list_static_delta_indexes
ostree_repo_static_delta_reindex
OstreeStaticDeltaGenerateOpt
ostree_repo_static_delta_generate
ostree_repo_static_delta_execute_offline_with_signature

View File

@ -20,6 +20,7 @@
LIBOSTREE_2020.8 {
global:
ostree_repo_list_static_delta_indexes;
ostree_repo_static_delta_reindex;
} LIBOSTREE_2020.7;
/* Stub section for the stable release *after* this development one; don't

View File

@ -1238,11 +1238,29 @@ file_has_content (OstreeRepo *repo,
return g_bytes_equal (existing_data, data);
}
/**
* ostree_repo_static_delta_reindex:
* @repo: Repo
* @flags: Flags affecting the indexing operation
* @opt_to_commit: ASCII SHA256 checksum of target commit, or %NULL to index all targets
* @cancellable: Cancellable
* @error: Error
*
* The delta index for a particular commit lists all the existing deltas that can be used
* when downloading that commit. This operation regenerates these indexes, either for
* a particular commit (if @opt_to_commit is non-%NULL), or for all commits that
* are reachable by an existing delta (if @opt_to_commit is %NULL).
*
* This is normally called automatically when the summary is updated in ostree_repo_regenerate_summary().
*
* Locking: shared
*/
gboolean
_ostree_repo_static_delta_reindex (OstreeRepo *repo,
const char *opt_to_commit,
GCancellable *cancellable,
GError **error)
ostree_repo_static_delta_reindex (OstreeRepo *repo,
OstreeStaticDeltaIndexFlags flags,
const char *opt_to_commit,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GPtrArray) all_deltas = NULL;
g_autoptr(GHashTable) deltas_to_commit_ht = NULL; /* map: to checksum -> ptrarray of from checksums (or NULL) */

View File

@ -5935,7 +5935,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
g_variant_ref_sink (summary);
}
if (!_ostree_repo_static_delta_reindex (self, NULL, cancellable, error))
if (!ostree_repo_static_delta_reindex (self, 0, NULL, cancellable, error))
return FALSE;
if (!_ostree_repo_file_replace_contents (self,

View File

@ -1074,6 +1074,23 @@ gboolean ostree_repo_static_delta_generate (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
/**
* OstreeStaticDeltaIndexFlags:
* @OSTREE_STATIC_DELTA_INDEX_FLAGS_NONE: No special flags
*
* Flags controlling static delta index generation.
*/
typedef enum {
OSTREE_STATIC_DELTA_INDEX_FLAGS_NONE = 0,
} OstreeStaticDeltaIndexFlags;
_OSTREE_PUBLIC
gboolean ostree_repo_static_delta_reindex (OstreeRepo *repo,
OstreeStaticDeltaIndexFlags flags,
const char *opt_to_commit,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_static_delta_execute_offline_with_signature (OstreeRepo *self,
GFile *dir_or_file,