ostree_repo_checkout_tree_at: New API for checkouts

rpm-ostree currently uses ostree_repo_checkout_tree(), which as a side
effect will use the uncompressed objects cache by default.  This is
rather annoying if you're using rpm-ostree on a server-side
repository, because if you then rsync the repo, you'll be syncing out
the uncompressed objects unless you exclude them.

We added the ability to disable the uncompressed cache in the
repository config to fix this, but it's better to allow application
control over this.  The uncompressed cache will in some future version
become opt in as well.

This new API further:
 - Drops the `GFile` usage in favor of `openat` APIs
 - Improves ergonomics by avoiding callers having to query the source
   `GFileInfo` (and carry around a copy of `OSTREE_GIO_FAST_QUERYINFO`)
 - Has a more extensible options structure

Per the comment, I rather crudely have the `ostree checkout` builtin
call both APIs to ensure some testing coverage.

However, I'd like to in the future have easier-to-set-up testing code
that calls `libtest.sh` to set up dummy data.
This commit is contained in:
Colin Walters committed 2015-04-07 15:12:16 -04:00
1 parent 115e05746b
commit c2aabcac3b
5 files changed
+236 -78

No files matched your search

+30
View File
@@ -449,6 +449,36 @@ ostree_repo_checkout_tree (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
/**
* OstreeRepoCheckoutOptions:
*
* An extensible options structure controlling checkout. Ensure that
* you have entirely zeroed the structure, then set just the desired
* options. This is used by ostree_repo_checkout_tree_at() which
* supercedes previous separate enumeration usage in
* ostree_repo_checkout_tree().
*/
typedef struct {
OstreeRepoCheckoutMode mode;
OstreeRepoCheckoutOverwriteMode overwrite_mode;
guint enable_uncompressed_cache : 1;
guint unused : 31;
const char *subpath;
guint unused_uints[6];
gpointer unused_ptrs[8];
} OstreeRepoCheckoutOptions;
gboolean ostree_repo_checkout_tree_at (OstreeRepo *self,
OstreeRepoCheckoutOptions *options,
int destination_dfd,
const char *destination_path,
const char *commit,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_checkout_gc (OstreeRepo *self,
GCancellable *cancellable,
GError **error);