deltas: Make ostree_repo_static_delta_reindex() public
authorAlexander Larsson <alexl@redhat.com>
Mon, 12 Oct 2020 13:57:53 +0000 (15:57 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 23 Oct 2020 10:30:08 +0000 (12:30 +0200)
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.

apidoc/ostree-sections.txt
src/libostree/libostree-devel.sym
src/libostree/ostree-repo-static-delta-core.c
src/libostree/ostree-repo.c
src/libostree/ostree-repo.h

index ea37823bf385a16dda3dc888a2b77a5a5b2449ee..81dc889082f4f3f4bff310300565c2f6bd52ea77 100644 (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
index 1350341ceffb01284436c5268abd8a6f93237bf1..82d6a9b6f1934cf9e7e59e4449a278b87fac7ff2 100644 (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
index c58e3683874936a0dfd1073799595e8df932db93..670a10a51531e0cd7c1ce2249b9f79bccd0c982b 100644 (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) */
index 9d9146b3a55a582458fd8faf21e442c1185d25d4..c22a6666c6e58091d1d6ed50d051fe0398d71c80 100644 (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,
index a3c5dc7799ca8d85a4c2066bf79918014ec2798c..6201e7b3c904c53981a88f979be7c58ddf812e8a 100644 (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,