diff --git a/rust-bindings/rust/libostree/src/auto/async_progress.rs b/rust-bindings/rust/libostree/src/auto/async_progress.rs index 587602d8..b6c130a3 100644 --- a/rust-bindings/rust/libostree/src/auto/async_progress.rs +++ b/rust-bindings/rust/libostree/src/auto/async_progress.rs @@ -25,6 +25,10 @@ glib_wrapper! { } impl AsyncProgress { + /// + /// # Returns + /// + /// A new progress object pub fn new() -> AsyncProgress { unsafe { from_glib_full(ffi::ostree_async_progress_new()) @@ -42,12 +46,32 @@ impl Default for AsyncProgress { } } +/// Trait containing all `AsyncProgress` methods. +/// +/// # Implementors +/// +/// [`AsyncProgress`](struct.AsyncProgress.html) pub trait AsyncProgressExt { + /// Process any pending signals, ensuring the main context is cleared + /// of sources used by this object. Also ensures that no further + /// events will be queued. fn finish(&self); //#[cfg(any(feature = "v2017_6", feature = "dox"))] //fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); + /// Get the human-readable status string from the `AsyncProgress`. This + /// operation is thread-safe. The retuned value may be `None` if no status is + /// set. + /// + /// This is a convenience function to get the well-known `status` key. + /// + /// Feature: `v2017_6` + /// + /// + /// # Returns + /// + /// the current status, or `None` if none is set #[cfg(any(feature = "v2017_6", feature = "dox"))] fn get_status(&self) -> Option; @@ -55,12 +79,33 @@ pub trait AsyncProgressExt { fn get_uint64(&self, key: &str) -> u64; + /// Look up a key in the `AsyncProgress` and return the `glib::Variant` associated + /// with it. The lookup is thread-safe. + /// + /// Feature: `v2017_6` + /// + /// ## `key` + /// a key to look up + /// + /// # Returns + /// + /// value for the given `key`, or `None` if + /// it was not set #[cfg(any(feature = "v2017_6", feature = "dox"))] fn get_variant(&self, key: &str) -> Option; //#[cfg(any(feature = "v2017_6", feature = "dox"))] //fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); + /// Set the human-readable status string for the `AsyncProgress`. This + /// operation is thread-safe. `None` may be passed to clear the status. + /// + /// This is a convenience function to set the well-known `status` key. + /// + /// Feature: `v2017_6` + /// + /// ## `status` + /// new status string, or `None` to clear the status #[cfg(any(feature = "v2017_6", feature = "dox"))] fn set_status<'a, P: Into>>(&self, status: P); @@ -68,9 +113,23 @@ pub trait AsyncProgressExt { fn set_uint64(&self, key: &str, value: u64); + /// Assign a new `value` to the given `key`, replacing any existing value. The + /// operation is thread-safe. `value` may be a floating reference; + /// `glib::Variant::ref_sink` will be called on it. + /// + /// Any watchers of the `AsyncProgress` will be notified of the change if + /// `value` differs from the existing value for `key`. + /// + /// Feature: `v2017_6` + /// + /// ## `key` + /// a key to set + /// ## `value` + /// the value to assign to `key` #[cfg(any(feature = "v2017_6", feature = "dox"))] fn set_variant(&self, key: &str, value: &glib::Variant); + /// Emitted when `self_` has been changed. fn connect_changed(&self, f: F) -> SignalHandlerId; } diff --git a/rust-bindings/rust/libostree/src/auto/collection_ref.rs b/rust-bindings/rust/libostree/src/auto/collection_ref.rs index c4dad645..a9d5b917 100644 --- a/rust-bindings/rust/libostree/src/auto/collection_ref.rs +++ b/rust-bindings/rust/libostree/src/auto/collection_ref.rs @@ -22,6 +22,21 @@ glib_wrapper! { } impl CollectionRef { + /// Create a new `CollectionRef` containing (`collection_id`, `ref_name`). If + /// `collection_id` is `None`, this is equivalent to a plain ref name string (not a + /// refspec; no remote name is included), which can be used for non-P2P + /// operations. + /// + /// Feature: `v2018_6` + /// + /// ## `collection_id` + /// a collection ID, or `None` for a plain ref + /// ## `ref_name` + /// a ref name + /// + /// # Returns + /// + /// a new `CollectionRef` #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn new<'a, P: Into>>(collection_id: P, ref_name: &str) -> CollectionRef { let collection_id = collection_id.into(); @@ -31,6 +46,14 @@ impl CollectionRef { } } + /// Create a copy of the given `self`. + /// + /// Feature: `v2018_6` + /// + /// + /// # Returns + /// + /// a newly allocated copy of `self` #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn dup(&self) -> Option { unsafe { @@ -38,6 +61,18 @@ impl CollectionRef { } } + /// Copy an array of `OstreeCollectionRefs`, including deep copies of all its + /// elements. `refs` must be `None`-terminated; it may be empty, but must not be + /// `None`. + /// + /// Feature: `v2018_6` + /// + /// ## `refs` + /// `None`-terminated array of `OstreeCollectionRefs` + /// + /// # Returns + /// + /// a newly allocated copy of `refs` #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn dupv(refs: &[&CollectionRef]) -> Vec { unsafe { @@ -45,6 +80,19 @@ impl CollectionRef { } } + /// Compare `ref1` and `ref2` and return `true` if they have the same collection ID and + /// ref name, and `false` otherwise. Both `ref1` and `ref2` must be non-`None`. + /// + /// Feature: `v2018_6` + /// + /// ## `ref1` + /// an `CollectionRef` + /// ## `ref2` + /// another `CollectionRef` + /// + /// # Returns + /// + /// `true` if `ref1` and `ref2` are equal, `false` otherwise #[cfg(any(feature = "v2018_6", feature = "dox"))] fn equal<'a, P: Into>>(&self, ref2: P) -> bool { unsafe { @@ -52,6 +100,13 @@ impl CollectionRef { } } + /// Free the given array of `refs`, including freeing all its elements. `refs` + /// must be `None`-terminated; it may be empty, but must not be `None`. + /// + /// Feature: `v2018_6` + /// + /// ## `refs` + /// an array of `OstreeCollectionRefs` #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn freev(refs: &[&CollectionRef]) { unsafe { @@ -59,6 +114,17 @@ impl CollectionRef { } } + /// Hash the given `ref_`. This function is suitable for use with `glib::HashTable`. + /// `ref_` must be non-`None`. + /// + /// Feature: `v2018_6` + /// + /// ## `ref_` + /// an `CollectionRef` + /// + /// # Returns + /// + /// hash value for `ref_` #[cfg(any(feature = "v2018_6", feature = "dox"))] fn hash(&self) -> u32 { unsafe { diff --git a/rust-bindings/rust/libostree/src/auto/enums.rs b/rust-bindings/rust/libostree/src/auto/enums.rs index 85260f12..521bc7e5 100644 --- a/rust-bindings/rust/libostree/src/auto/enums.rs +++ b/rust-bindings/rust/libostree/src/auto/enums.rs @@ -5,6 +5,9 @@ use ffi; use glib::translate::*; +/// Formatting flags for `GpgVerifyResultExt::describe`. Currently +/// there's only one possible output format, but this enumeration allows +/// for future variations. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum GpgSignatureFormatFlags { @@ -35,6 +38,8 @@ impl FromGlib for GpgSignatureFormatFlags { } } +/// Enumeration for core object types; `ObjectType::File` is for +/// content, the other types are metadata. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum ObjectType { @@ -155,6 +160,8 @@ impl FromGlib for RepoCheckoutOverwriteMod } } +/// See the documentation of `Repo` for more information about the +/// possible modes. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum RepoMode { @@ -230,6 +237,7 @@ impl FromGlib for RepoPruneFlags { } } +/// The remote change operation. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum RepoRemoteChange { @@ -299,6 +307,7 @@ impl FromGlib for RepoResolveRevExtFlags { } } +/// Parameters controlling optimization of static deltas. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum StaticDeltaGenerateOpt { diff --git a/rust-bindings/rust/libostree/src/auto/gpg_verify_result.rs b/rust-bindings/rust/libostree/src/auto/gpg_verify_result.rs index c6f32955..f312443f 100644 --- a/rust-bindings/rust/libostree/src/auto/gpg_verify_result.rs +++ b/rust-bindings/rust/libostree/src/auto/gpg_verify_result.rs @@ -22,6 +22,20 @@ glib_wrapper! { } impl GpgVerifyResult { + /// Similar to `GpgVerifyResultExt::describe` but takes a `glib::Variant` of + /// all attributes for a GPG signature instead of an `GpgVerifyResult` + /// and signature index. + /// + /// The `variant` ``MUST`` have been created by + /// `GpgVerifyResultExt::get_all`. + /// ## `variant` + /// a `glib::Variant` from `GpgVerifyResultExt::get_all` + /// ## `output_buffer` + /// a `glib::String` to hold the description + /// ## `line_prefix` + /// optional line prefix string + /// ## `flags` + /// flags to adjust the description format pub fn describe_variant<'a, P: Into>>(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags) { let line_prefix = line_prefix.into(); let line_prefix = line_prefix.to_glib_none(); @@ -31,19 +45,105 @@ impl GpgVerifyResult { } } +/// Trait containing all `GpgVerifyResult` methods. +/// +/// # Implementors +/// +/// [`GpgVerifyResult`](struct.GpgVerifyResult.html) pub trait GpgVerifyResultExt { + /// Counts all the signatures in `self`. + /// + /// # Returns + /// + /// signature count fn count_all(&self) -> u32; + /// Counts only the valid signatures in `self`. + /// + /// # Returns + /// + /// valid signature count fn count_valid(&self) -> u32; + /// Appends a brief, human-readable description of the GPG signature at + /// `signature_index` in `self` to the `output_buffer`. The description + /// spans multiple lines. A `line_prefix` string, if given, will precede + /// each line of the description. + /// + /// The `flags` argument is reserved for future variations to the description + /// format. Currently must be 0. + /// + /// It is a programmer error to request an invalid `signature_index`. Use + /// `GpgVerifyResultExt::count_all` to find the number of signatures in + /// `self`. + /// ## `signature_index` + /// which signature to describe + /// ## `output_buffer` + /// a `glib::String` to hold the description + /// ## `line_prefix` + /// optional line prefix string + /// ## `flags` + /// flags to adjust the description format fn describe<'a, P: Into>>(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags); //fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 26 }) -> Option; + /// Builds a `glib::Variant` tuple of all available attributes for the GPG signature + /// at `signature_index` in `self`. + /// + /// The child values in the returned `glib::Variant` tuple are ordered to match the + /// `GpgSignatureAttr` enumeration, which means the enum values can be + /// used as index values in functions like `glib::Variant::get_child`. See the + /// `GpgSignatureAttr` description for the `glib::VariantType` of each + /// available attribute. + /// + /// `` + /// `` + /// The `GpgSignatureAttr` enumeration may be extended in the future + /// with new attributes, which would affect the `glib::Variant` tuple returned by + /// this function. While the position and type of current child values in + /// the `glib::Variant` tuple will not change, to avoid backward-compatibility + /// issues ``please do not depend on the tuple's overall size or + /// type signature``. + /// `` + /// `` + /// + /// It is a programmer error to request an invalid `signature_index`. Use + /// `GpgVerifyResultExt::count_all` to find the number of signatures in + /// `self`. + /// ## `signature_index` + /// which signature to get attributes from + /// + /// # Returns + /// + /// a new, floating, `glib::Variant` tuple fn get_all(&self, signature_index: u32) -> Option; + /// Searches `self` for a signature signed by `key_id`. If a match is found, + /// the function returns `true` and sets `out_signature_index` so that further + /// signature details can be obtained through `GpgVerifyResultExt::get`. + /// If no match is found, the function returns `false` and leaves + /// `out_signature_index` unchanged. + /// ## `key_id` + /// a GPG key ID or fingerprint + /// ## `out_signature_index` + /// return location for the index of the signature + /// signed by `key_id`, or `None` + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn lookup(&self, key_id: &str) -> Option; + /// Checks if the result contains at least one signature from the + /// trusted keyring. You can call this function immediately after + /// `RepoExt::verify_summary` or `RepoExt::verify_commit_ext` - + /// it will handle the `None` `self` and filled `error` too. + /// + /// # Returns + /// + /// `true` if `self` was not `None` and had at least one + /// signature from trusted keyring, otherwise `false` fn require_valid_signature(&self) -> Result<(), Error>; } diff --git a/rust-bindings/rust/libostree/src/auto/mutable_tree.rs b/rust-bindings/rust/libostree/src/auto/mutable_tree.rs index e4c368d1..8538a812 100644 --- a/rust-bindings/rust/libostree/src/auto/mutable_tree.rs +++ b/rust-bindings/rust/libostree/src/auto/mutable_tree.rs @@ -21,12 +21,28 @@ glib_wrapper! { } impl MutableTree { + /// + /// # Returns + /// + /// A new tree pub fn new() -> MutableTree { unsafe { from_glib_full(ffi::ostree_mutable_tree_new()) } } + /// Creates a new OstreeMutableTree with the contents taken from the given repo + /// and checksums. The data will be loaded from the repo lazily as needed. + /// ## `repo` + /// The repo which contains the objects refered by the checksums. + /// ## `contents_checksum` + /// dirtree checksum + /// ## `metadata_checksum` + /// dirmeta checksum + /// + /// # Returns + /// + /// A new tree pub fn new_from_checksum(repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> MutableTree { unsafe { from_glib_full(ffi::ostree_mutable_tree_new_from_checksum(repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0)) @@ -40,14 +56,49 @@ impl Default for MutableTree { } } +/// Trait containing all `MutableTree` methods. +/// +/// # Implementors +/// +/// [`MutableTree`](struct.MutableTree.html) pub trait MutableTreeExt { + /// In some cases, a tree may be in a "lazy" state that loads + /// data in the background; if an error occurred during a non-throwing + /// API call, it will have been cached. This function checks for a + /// cached error. The tree remains in error state. + /// + /// Feature: `v2018_7` + /// + /// + /// # Returns + /// + /// `TRUE` on success #[cfg(any(feature = "v2018_7", feature = "dox"))] fn check_error(&self) -> Result<(), Error>; + /// Returns the subdirectory of self with filename `name`, creating an empty one + /// it if it doesn't exist. + /// ## `name` + /// Name of subdirectory of self to retrieve/creates + /// ## `out_subdir` + /// the subdirectory fn ensure_dir(&self, name: &str) -> Result; //fn ensure_parent_dirs(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, metadata_checksum: &str) -> Result; + /// Merges `self` with the tree given by `contents_checksum` and + /// `metadata_checksum`, but only if it's possible without writing new objects to + /// the `repo`. We can do this if either `self` is empty, the tree given by + /// `contents_checksum` is empty or if both trees already have the same + /// `contents_checksum`. + /// + /// # Returns + /// + /// `true` if merge was successful, `false` if it was not possible. + /// + /// This function enables optimisations when composing trees. The provided + /// checksums are not loaded or checked when this function is called. Instead + /// the contents will be loaded only when needed. fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool; fn get_contents_checksum(&self) -> Option; diff --git a/rust-bindings/rust/libostree/src/auto/remote.rs b/rust-bindings/rust/libostree/src/auto/remote.rs index 51d6b49e..a13f42a4 100644 --- a/rust-bindings/rust/libostree/src/auto/remote.rs +++ b/rust-bindings/rust/libostree/src/auto/remote.rs @@ -21,6 +21,16 @@ glib_wrapper! { } impl Remote { + /// Get the human-readable name of the remote. This is what the user configured, + /// if the remote was explicitly configured; and will otherwise be a stable, + /// arbitrary, string. + /// + /// Feature: `v2018_6` + /// + /// + /// # Returns + /// + /// remote’s name #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn get_name(&self) -> Option { unsafe { @@ -28,6 +38,14 @@ impl Remote { } } + /// Get the URL from the remote. + /// + /// Feature: `v2018_6` + /// + /// + /// # Returns + /// + /// the remote's URL #[cfg(any(feature = "v2018_6", feature = "dox"))] pub fn get_url(&self) -> Option { unsafe { diff --git a/rust-bindings/rust/libostree/src/auto/repo.rs b/rust-bindings/rust/libostree/src/auto/repo.rs index fa58c00a..124ddc88 100644 --- a/rust-bindings/rust/libostree/src/auto/repo.rs +++ b/rust-bindings/rust/libostree/src/auto/repo.rs @@ -51,24 +51,75 @@ glib_wrapper! { } impl Repo { + /// ## `path` + /// Path to a repository + /// + /// # Returns + /// + /// An accessor object for an OSTree repository located at `path` pub fn new>(path: &P) -> Repo { unsafe { from_glib_full(ffi::ostree_repo_new(path.to_glib_none().0)) } } + /// If the current working directory appears to be an OSTree + /// repository, create a new `Repo` object for accessing it. + /// Otherwise use the path in the OSTREE_REPO environment variable + /// (if defined) or else the default system repository located at + /// /ostree/repo. + /// + /// # Returns + /// + /// An accessor object for an OSTree repository located at /ostree/repo pub fn new_default() -> Repo { unsafe { from_glib_full(ffi::ostree_repo_new_default()) } } + /// Creates a new `Repo` instance, taking the system root path explicitly + /// instead of assuming "/". + /// ## `repo_path` + /// Path to a repository + /// ## `sysroot_path` + /// Path to the system root + /// + /// # Returns + /// + /// An accessor object for the OSTree repository located at `repo_path`. pub fn new_for_sysroot_path, Q: IsA>(repo_path: &P, sysroot_path: &Q) -> Repo { unsafe { from_glib_full(ffi::ostree_repo_new_for_sysroot_path(repo_path.to_glib_none().0, sysroot_path.to_glib_none().0)) } } + /// This is a file-descriptor relative version of `RepoExt::create`. + /// Create the underlying structure on disk for the repository, and call + /// `Repo::open_at` on the result, preparing it for use. + /// + /// If a repository already exists at `dfd` + `path` (defined by an `objects/` + /// subdirectory existing), then this function will simply call + /// `Repo::open_at`. In other words, this function cannot be used to change + /// the mode or configuration (`repo/config`) of an existing repo. + /// + /// The `options` dict may contain: + /// + /// - collection-id: s: Set as collection ID in repo/config (Since 2017.9) + /// ## `dfd` + /// Directory fd + /// ## `path` + /// Path + /// ## `mode` + /// The mode to store the repository in + /// ## `options` + /// a{sv}: See below for accepted keys + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// A new OSTree repository reference pub fn create_at<'a, P: Into>>(dfd: i32, path: &str, mode: RepoMode, options: &glib::Variant, cancellable: P) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); @@ -79,6 +130,17 @@ impl Repo { } } + /// This combines `Repo::new` (but using fd-relative access) with + /// `RepoExt::open`. Use this when you know you should be operating on an + /// already extant repository. If you want to create one, use `Repo::create_at`. + /// ## `dfd` + /// Directory fd + /// ## `path` + /// Path + /// + /// # Returns + /// + /// An accessor object for an OSTree repository located at `dfd` + `path` pub fn open_at<'a, P: Into>>(dfd: i32, path: &str, cancellable: P) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); @@ -108,73 +170,365 @@ impl Repo { //} } +/// Trait containing all `Repo` methods. +/// +/// # Implementors +/// +/// [`Repo`](struct.Repo.html) pub trait RepoExt { + /// Abort the active transaction; any staged objects and ref changes will be + /// discarded. You *must* invoke this if you have chosen not to invoke + /// `RepoExt::commit_transaction`. Calling this function when not in a + /// transaction will do nothing and return successfully. + /// ## `cancellable` + /// Cancellable fn abort_transaction<'a, P: Into>>(&self, cancellable: P) -> Result<(), Error>; + /// Add a GPG signature to a summary file. + /// ## `key_id` + /// NULL-terminated array of GPG keys. + /// ## `homedir` + /// GPG home directory, or `None` + /// ## `cancellable` + /// A `gio::Cancellable` fn add_gpg_signature_summary<'a, 'b, P: Into>, Q: Into>>(&self, key_id: &[&str], homedir: P, cancellable: Q) -> Result<(), Error>; + /// Append a GPG signature to a commit. + /// ## `commit_checksum` + /// SHA256 of given commit to sign + /// ## `signature_bytes` + /// Signature data + /// ## `cancellable` + /// A `gio::Cancellable` fn append_gpg_signature<'a, P: Into>>(&self, commit_checksum: &str, signature_bytes: &glib::Bytes, cancellable: P) -> Result<(), Error>; //fn checkout_at<'a, 'b, P: Into>, Q: Into>>(&self, options: P, destination_dfd: i32, destination_path: &str, commit: &str, cancellable: Q) -> Result<(), Error>; + /// Call this after finishing a succession of checkout operations; it + /// will delete any currently-unused uncompressed objects from the + /// cache. + /// ## `cancellable` + /// Cancellable fn checkout_gc<'a, P: Into>>(&self, cancellable: P) -> Result<(), Error>; + /// Check out `source` into `destination`, which must live on the + /// physical filesystem. `source` may be any subdirectory of a given + /// commit. The `mode` and `overwrite_mode` allow control over how the + /// files are checked out. + /// ## `mode` + /// Options controlling all files + /// ## `overwrite_mode` + /// Whether or not to overwrite files + /// ## `destination` + /// Place tree here + /// ## `source` + /// Source tree + /// ## `source_info` + /// Source info + /// ## `cancellable` + /// Cancellable fn checkout_tree<'a, P: IsA, Q: Into>>(&self, mode: RepoCheckoutMode, overwrite_mode: RepoCheckoutOverwriteMode, destination: &P, source: &RepoFile, source_info: &gio::FileInfo, cancellable: Q) -> Result<(), Error>; //fn checkout_tree_at<'a, 'b, P: Into>, Q: Into>>(&self, options: P, destination_dfd: i32, destination_path: &str, commit: &str, cancellable: Q) -> Result<(), Error>; + /// Complete the transaction. Any refs set with + /// `RepoExt::transaction_set_ref` or + /// `RepoExt::transaction_set_refspec` will be written out. + /// + /// Note that if multiple threads are performing writes, all such threads must + /// have terminated before this function is invoked. + /// + /// Locking: Releases `shared` lock acquired by `ostree_repo_prepare_transaction()` + /// Multithreading: This function is *not* MT safe; only one transaction can be + /// active at a time. + /// ## `out_stats` + /// A set of statistics of things + /// that happened during this transaction. + /// ## `cancellable` + /// Cancellable fn commit_transaction<'a, P: Into>>(&self, cancellable: P) -> Result; + /// + /// # Returns + /// + /// A newly-allocated copy of the repository config fn copy_config(&self) -> Option; + /// Create the underlying structure on disk for the repository, and call + /// `RepoExt::open` on the result, preparing it for use. + /// + /// Since version 2016.8, this function will succeed on an existing + /// repository, and finish creating any necessary files in a partially + /// created repository. However, this function cannot change the mode + /// of an existing repository, and will silently ignore an attempt to + /// do so. + /// + /// Since 2017.9, "existing repository" is defined by the existence of an + /// `objects` subdirectory. + /// + /// This function predates `Repo::create_at`. It is an error to call + /// this function on a repository initialized via `Repo::open_at`. + /// ## `mode` + /// The mode to store the repository in + /// ## `cancellable` + /// Cancellable fn create<'a, P: Into>>(&self, mode: RepoMode, cancellable: P) -> Result<(), Error>; + /// Remove the object of type `objtype` with checksum `sha256` + /// from the repository. An error of type `gio::IOErrorEnum::NotFound` + /// is thrown if the object does not exist. + /// ## `objtype` + /// Object type + /// ## `sha256` + /// Checksum + /// ## `cancellable` + /// Cancellable fn delete_object<'a, P: Into>>(&self, objtype: ObjectType, sha256: &str, cancellable: P) -> Result<(), Error>; + /// Check whether two opened repositories are the same on disk: if their root + /// directories are the same inode. If `self` or `b` are not open yet (due to + /// `RepoExt::open` not being called on them yet), `false` will be returned. + /// + /// Feature: `v2017_12` + /// + /// ## `b` + /// an `Repo` + /// + /// # Returns + /// + /// `true` if `self` and `b` are the same repository on disk, `false` otherwise #[cfg(any(feature = "v2017_12", feature = "dox"))] fn equal(&self, b: &Repo) -> bool; //fn export_tree_to_archive<'a, P: Into>, Q: Into>>(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: P, cancellable: Q) -> Result<(), Error>; + /// Verify consistency of the object; this performs checks only relevant to the + /// immediate object itself, such as checksumming. This API call will not itself + /// traverse metadata objects for example. + /// + /// Feature: `v2017_15` + /// + /// ## `objtype` + /// Object type + /// ## `sha256` + /// Checksum + /// ## `cancellable` + /// Cancellable #[cfg(any(feature = "v2017_15", feature = "dox"))] fn fsck_object<'a, P: Into>>(&self, objtype: ObjectType, sha256: &str, cancellable: P) -> Result<(), Error>; + /// Get the collection ID of this repository. See [collection IDs][collection-ids]. + /// + /// Feature: `v2018_6` + /// + /// + /// # Returns + /// + /// collection ID for the repository #[cfg(any(feature = "v2018_6", feature = "dox"))] fn get_collection_id(&self) -> Option; + /// + /// # Returns + /// + /// The repository configuration; do not modify fn get_config(&self) -> Option; + /// In some cases it's useful for applications to access the repository + /// directly; for example, writing content into `repo/tmp` ensures it's + /// on the same filesystem. Another case is detecting the mtime on the + /// repository (to see whether a ref was written). + /// + /// # Returns + /// + /// File descriptor for repository root - owned by `self` fn get_dfd(&self) -> i32; + /// For more information see `RepoExt::set_disable_fsync`. + /// + /// # Returns + /// + /// Whether or not `fsync` is enabled for this repo. fn get_disable_fsync(&self) -> bool; fn get_mode(&self) -> RepoMode; + /// Before this function can be used, `ostree_repo_init` must have been + /// called. + /// + /// # Returns + /// + /// Parent repository, or `None` if none fn get_parent(&self) -> Option; + /// Note that since the introduction of `Repo::open_at`, this function may + /// return a process-specific path in `/proc` if the repository was created using + /// that API. In general, you should avoid use of this API. + /// + /// # Returns + /// + /// Path to repo fn get_path(&self) -> Option; + /// OSTree remotes are represented by keyfile groups, formatted like: + /// `[remote "remotename"]`. This function returns a value named `option_name` + /// underneath that group, and returns it as a boolean. + /// If the option is not set, `out_value` will be set to `default_value`. If an + /// error is returned, `out_value` will be set to `false`. + /// ## `remote_name` + /// Name + /// ## `option_name` + /// Option + /// ## `default_value` + /// Value returned if `option_name` is not present + /// ## `out_value` + /// location to store the result. + /// + /// # Returns + /// + /// `true` on success, otherwise `false` with `error` set fn get_remote_boolean_option(&self, remote_name: &str, option_name: &str, default_value: bool) -> Result; + /// OSTree remotes are represented by keyfile groups, formatted like: + /// `[remote "remotename"]`. This function returns a value named `option_name` + /// underneath that group, and returns it as a zero terminated array of strings. + /// If the option is not set, or if an error is returned, `out_value` will be set + /// to `None`. + /// ## `remote_name` + /// Name + /// ## `option_name` + /// Option + /// ## `out_value` + /// location to store the list + /// of strings. The list should be freed with + /// `g_strfreev`. + /// + /// # Returns + /// + /// `true` on success, otherwise `false` with `error` set fn get_remote_list_option(&self, remote_name: &str, option_name: &str) -> Result, Error>; + /// OSTree remotes are represented by keyfile groups, formatted like: + /// `[remote "remotename"]`. This function returns a value named `option_name` + /// underneath that group, or `default_value` if the remote exists but not the + /// option name. If an error is returned, `out_value` will be set to `None`. + /// ## `remote_name` + /// Name + /// ## `option_name` + /// Option + /// ## `default_value` + /// Value returned if `option_name` is not present + /// ## `out_value` + /// Return location for value + /// + /// # Returns + /// + /// `true` on success, otherwise `false` with `error` set fn get_remote_option<'a, P: Into>>(&self, remote_name: &str, option_name: &str, default_value: P) -> Result; + /// Verify `signatures` for `data` using GPG keys in the keyring for + /// `remote_name`, and return an `GpgVerifyResult`. + /// + /// The `remote_name` parameter can be `None`. In that case it will do + /// the verifications using GPG keys in the keyrings of all remotes. + /// ## `remote_name` + /// Name of remote + /// ## `data` + /// Data as a `glib::Bytes` + /// ## `signatures` + /// Signatures as a `glib::Bytes` + /// ## `keyringdir` + /// Path to directory GPG keyrings; overrides built-in default if given + /// ## `extra_keyring` + /// Path to additional keyring file (not a directory) + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// an `GpgVerifyResult`, or `None` on error fn gpg_verify_data<'a, 'b, 'c, 'd, P: Into>, Q: IsA + 'b, R: Into>, S: IsA + 'c, T: Into>, U: Into>>(&self, remote_name: P, data: &glib::Bytes, signatures: &glib::Bytes, keyringdir: R, extra_keyring: T, cancellable: U) -> Result; + /// Set `out_have_object` to `true` if `self` contains the given object; + /// `false` otherwise. + /// ## `objtype` + /// Object type + /// ## `checksum` + /// ASCII SHA256 checksum + /// ## `out_have_object` + /// `true` if repository contains object + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// `false` if an unexpected error occurred, `true` otherwise fn has_object<'a, P: Into>>(&self, objtype: ObjectType, checksum: &str, cancellable: P) -> Result; + /// Calculate a hash value for the given open repository, suitable for use when + /// putting it into a hash table. It is an error to call this on an `Repo` + /// which is not yet open, as a persistent hash value cannot be calculated until + /// the repository is open and the inode of its root directory has been loaded. + /// + /// This function does no I/O. + /// + /// Feature: `v2017_12` + /// + /// + /// # Returns + /// + /// hash value for the `Repo` #[cfg(any(feature = "v2017_12", feature = "dox"))] fn hash(&self) -> u32; //fn import_archive_to_mtree<'a, 'b, P: Into>, Q: Into>, R: Into>>(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: P, mtree: &MutableTree, modifier: Q, cancellable: R) -> Result<(), Error>; + /// Copy object named by `objtype` and `checksum` into `self` from the + /// source repository `source`. If both repositories are of the same + /// type and on the same filesystem, this will simply be a fast Unix + /// hard link operation. + /// + /// Otherwise, a copy will be performed. + /// ## `source` + /// Source repo + /// ## `objtype` + /// Object type + /// ## `checksum` + /// checksum + /// ## `cancellable` + /// Cancellable fn import_object_from<'a, P: Into>>(&self, source: &Repo, objtype: ObjectType, checksum: &str, cancellable: P) -> Result<(), Error>; + /// Copy object named by `objtype` and `checksum` into `self` from the + /// source repository `source`. If both repositories are of the same + /// type and on the same filesystem, this will simply be a fast Unix + /// hard link operation. + /// + /// Otherwise, a copy will be performed. + /// ## `source` + /// Source repo + /// ## `objtype` + /// Object type + /// ## `checksum` + /// checksum + /// ## `trusted` + /// If `true`, assume the source repo is valid and trusted + /// ## `cancellable` + /// Cancellable fn import_object_from_with_trust<'a, P: Into>>(&self, source: &Repo, objtype: ObjectType, checksum: &str, trusted: bool, cancellable: P) -> Result<(), Error>; + /// + /// # Returns + /// + /// `true` if this repository is the root-owned system global repository fn is_system(&self) -> bool; + /// Returns whether the repository is writable by the current user. + /// If the repository is not writable, the `error` indicates why. + /// + /// # Returns + /// + /// `true` if this repository is writable fn is_writable(&self) -> Result<(), Error>; //#[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -190,62 +544,448 @@ pub trait RepoExt { //fn list_static_delta_names<'a, P: Into>>(&self, out_deltas: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, cancellable: P) -> Result<(), Error>; + /// A version of `RepoExt::load_variant` specialized to commits, + /// capable of returning extended state information. Currently + /// the only extended state is `RepoCommitState::Partial`, which + /// means that only a sub-path of the commit is available. + /// + /// Feature: `v2015_7` + /// + /// ## `checksum` + /// Commit checksum + /// ## `out_commit` + /// Commit + /// ## `out_state` + /// Commit state #[cfg(any(feature = "v2015_7", feature = "dox"))] fn load_commit(&self, checksum: &str) -> Result<(glib::Variant, RepoCommitState), Error>; + /// Load content object, decomposing it into three parts: the actual + /// content (for regular files), the metadata, and extended attributes. + /// ## `checksum` + /// ASCII SHA256 checksum + /// ## `out_input` + /// File content + /// ## `out_file_info` + /// File information + /// ## `out_xattrs` + /// Extended attributes + /// ## `cancellable` + /// Cancellable fn load_file<'a, P: Into>>(&self, checksum: &str, cancellable: P) -> Result<(Option, Option, Option), Error>; + /// Load object as a stream; useful when copying objects between + /// repositories. + /// ## `objtype` + /// Object type + /// ## `checksum` + /// ASCII SHA256 checksum + /// ## `out_input` + /// Stream for object + /// ## `out_size` + /// Length of `out_input` + /// ## `cancellable` + /// Cancellable fn load_object_stream<'a, P: Into>>(&self, objtype: ObjectType, checksum: &str, cancellable: P) -> Result<(gio::InputStream, u64), Error>; + /// Load the metadata object `sha256` of type `objtype`, storing the + /// result in `out_variant`. + /// ## `objtype` + /// Expected object type + /// ## `sha256` + /// Checksum string + /// ## `out_variant` + /// Metadata object fn load_variant(&self, objtype: ObjectType, sha256: &str) -> Result; + /// Attempt to load the metadata object `sha256` of type `objtype` if it + /// exists, storing the result in `out_variant`. If it doesn't exist, + /// `None` is returned. + /// ## `objtype` + /// Object type + /// ## `sha256` + /// ASCII checksum + /// ## `out_variant` + /// Metadata fn load_variant_if_exists(&self, objtype: ObjectType, sha256: &str) -> Result; + /// Commits in "partial" state do not have all their child objects written. This + /// occurs in various situations, such as during a pull, but also if a "subpath" + /// pull is used, as well as "commit only" pulls. + /// + /// This function is used by `RepoExt::pull_with_options`; you + /// should use this if you are implementing a different type of transport. + /// + /// Feature: `v2017_15` + /// + /// ## `checksum` + /// Commit SHA-256 + /// ## `is_partial` + /// Whether or not this commit is partial #[cfg(any(feature = "v2017_15", feature = "dox"))] fn mark_commit_partial(&self, checksum: &str, is_partial: bool) -> Result<(), Error>; fn open<'a, P: Into>>(&self, cancellable: P) -> Result<(), Error>; + /// Starts or resumes a transaction. In order to write to a repo, you + /// need to start a transaction. You can complete the transaction with + /// `RepoExt::commit_transaction`, or abort the transaction with + /// `RepoExt::abort_transaction`. + /// + /// Currently, transactions may result in partial commits or data in the target + /// repository if interrupted during `RepoExt::commit_transaction`, and + /// further writing refs is also not currently atomic. + /// + /// There can be at most one transaction active on a repo at a time per instance + /// of `OstreeRepo`; however, it is safe to have multiple threads writing objects + /// on a single `OstreeRepo` instance as long as their lifetime is bounded by the + /// transaction. + /// + /// Locking: Acquires a `shared` lock; release via commit or abort + /// Multithreading: This function is *not* MT safe; only one transaction can be + /// active at a time. + /// ## `out_transaction_resume` + /// Whether this transaction + /// is resuming from a previous one. This is a legacy state, now OSTree + /// pulls use per-commit `state/.commitpartial` files. + /// ## `cancellable` + /// Cancellable fn prepare_transaction<'a, P: Into>>(&self, cancellable: P) -> Result; + /// Delete content from the repository. By default, this function will + /// only delete "orphaned" objects not referred to by any commit. This + /// can happen during a local commit operation, when we have written + /// content objects but not saved the commit referencing them. + /// + /// However, if `RepoPruneFlags::RefsOnly` is provided, instead + /// of traversing all commits, only refs will be used. Particularly + /// when combined with `depth`, this is a convenient way to delete + /// history from the repository. + /// + /// Use the `RepoPruneFlags::NoPrune` to just determine + /// statistics on objects that would be deleted, without actually + /// deleting them. + /// + /// Locking: exclusive + /// ## `flags` + /// Options controlling prune process + /// ## `depth` + /// Stop traversal after this many iterations (-1 for unlimited) + /// ## `out_objects_total` + /// Number of objects found + /// ## `out_objects_pruned` + /// Number of objects deleted + /// ## `out_pruned_object_size_total` + /// Storage size in bytes of objects deleted + /// ## `cancellable` + /// Cancellable fn prune<'a, P: Into>>(&self, flags: RepoPruneFlags, depth: i32, cancellable: P) -> Result<(i32, i32, u64), Error>; //fn prune_from_reachable<'a, P: Into>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: P) -> Result<(i32, i32, u64), Error>; + /// Prune static deltas, if COMMIT is specified then delete static delta files only + /// targeting that commit; otherwise any static delta of non existing commits are + /// deleted. + /// + /// Locking: exclusive + /// ## `commit` + /// ASCII SHA256 checksum for commit, or `None` for each + /// non existing commit + /// ## `cancellable` + /// Cancellable fn prune_static_deltas<'a, 'b, P: Into>, Q: Into>>(&self, commit: P, cancellable: Q) -> Result<(), Error>; + /// Connect to the remote repository, fetching the specified set of + /// refs `refs_to_fetch`. For each ref that is changed, download the + /// commit, all metadata, and all content objects, storing them safely + /// on disk in `self`. + /// + /// If `flags` contains `RepoPullFlags::Mirror`, and + /// the `refs_to_fetch` is `None`, and the remote repository contains a + /// summary file, then all refs will be fetched. + /// + /// If `flags` contains `RepoPullFlags::CommitOnly`, then only the + /// metadata for the commits in `refs_to_fetch` is pulled. + /// + /// Warning: This API will iterate the thread default main context, + /// which is a bug, but kept for compatibility reasons. If you want to + /// avoid this, use `glib::MainContext::push_thread_default` to push a new + /// one around this call. + /// ## `remote_name` + /// Name of remote + /// ## `refs_to_fetch` + /// Optional list of refs; if `None`, fetch all configured refs + /// ## `flags` + /// Options controlling fetch behavior + /// ## `progress` + /// Progress + /// ## `cancellable` + /// Cancellable fn pull<'a, 'b, P: Into>, Q: Into>>(&self, remote_name: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: P, cancellable: Q) -> Result<(), Error>; + /// This is similar to `RepoExt::pull`, but only fetches a single + /// subpath. + /// ## `remote_name` + /// Name of remote + /// ## `dir_to_pull` + /// Subdirectory path + /// ## `refs_to_fetch` + /// Optional list of refs; if `None`, fetch all configured refs + /// ## `flags` + /// Options controlling fetch behavior + /// ## `progress` + /// Progress + /// ## `cancellable` + /// Cancellable fn pull_one_dir<'a, 'b, P: Into>, Q: Into>>(&self, remote_name: &str, dir_to_pull: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: P, cancellable: Q) -> Result<(), Error>; + /// Like `RepoExt::pull`, but supports an extensible set of flags. + /// The following are currently defined: + /// + /// * refs (as): Array of string refs + /// * collection-refs (a(sss)): Array of (collection ID, ref name, checksum) tuples to pull; + /// mutually exclusive with `refs` and `override-commit-ids`. Checksums may be the empty + /// string to pull the latest commit for that ref + /// * flags (i): An instance of `RepoPullFlags` + /// * subdir (s): Pull just this subdirectory + /// * subdirs (as): Pull just these subdirectories + /// * override-remote-name (s): If local, add this remote to refspec + /// * gpg-verify (b): GPG verify commits + /// * gpg-verify-summary (b): GPG verify summary + /// * depth (i): How far in the history to traverse; default is 0, -1 means infinite + /// * disable-static-deltas (b): Do not use static deltas + /// * require-static-deltas (b): Require static deltas + /// * override-commit-ids (as): Array of specific commit IDs to fetch for refs + /// * timestamp-check (b): Verify commit timestamps are newer than current (when pulling via ref); Since: 2017.11 + /// * dry-run (b): Only print information on what will be downloaded (requires static deltas) + /// * override-url (s): Fetch objects from this URL if remote specifies no metalink in options + /// * inherit-transaction (b): Don't initiate, finish or abort a transaction, useful to do multiple pulls in one transaction. + /// * http-headers (a(ss)): Additional headers to add to all HTTP requests + /// * update-frequency (u): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are valid + /// * localcache-repos (as): File paths for local repos to use as caches when doing remote fetches + /// * append-user-agent (s): Additional string to append to the user agent + /// * n-network-retries (u): Number of times to retry each download on receiving + /// a transient network error, such as a socket timeout; default is 5, 0 + /// means return errors without retrying + /// ## `remote_name_or_baseurl` + /// Name of remote or file:// url + /// ## `options` + /// A GVariant a{sv} with an extensible set of flags. + /// ## `progress` + /// Progress + /// ## `cancellable` + /// Cancellable fn pull_with_options<'a, 'b, P: Into>, Q: Into>>(&self, remote_name_or_baseurl: &str, options: &glib::Variant, progress: P, cancellable: Q) -> Result<(), Error>; + /// Return the size in bytes of object with checksum `sha256`, after any + /// compression has been applied. + /// ## `objtype` + /// Object type + /// ## `sha256` + /// Checksum + /// ## `out_size` + /// Size in bytes object occupies physically + /// ## `cancellable` + /// Cancellable fn query_object_storage_size<'a, P: Into>>(&self, objtype: ObjectType, sha256: &str, cancellable: P) -> Result; + /// Load the content for `rev` into `out_root`. + /// ## `ref_` + /// Ref or ASCII checksum + /// ## `out_root` + /// An `RepoFile` corresponding to the root + /// ## `out_commit` + /// The resolved commit checksum + /// ## `cancellable` + /// Cancellable fn read_commit<'a, P: Into>>(&self, ref_: &str, cancellable: P) -> Result<(gio::File, String), Error>; + /// OSTree commits can have arbitrary metadata associated; this + /// function retrieves them. If none exists, `out_metadata` will be set + /// to `None`. + /// ## `checksum` + /// ASCII SHA256 commit checksum + /// ## `out_metadata` + /// Metadata associated with commit in with format "a{sv}", or `None` if none exists + /// ## `cancellable` + /// Cancellable fn read_commit_detached_metadata<'a, P: Into>>(&self, checksum: &str, cancellable: P) -> Result; + /// An OSTree repository can contain a high level "summary" file that + /// describes the available branches and other metadata. + /// + /// If the timetable for making commits and updating the summary file is fairly + /// regular, setting the `ostree.summary.expires` key in `additional_metadata` + /// will aid clients in working out when to check for updates. + /// + /// It is regenerated automatically after any ref is + /// added, removed, or updated if `core/auto-update-summary` is set. + /// + /// If the `core/collection-id` key is set in the configuration, it will be + /// included as `OSTREE_SUMMARY_COLLECTION_ID` in the summary file. Refs that + /// have associated collection IDs will be included in the generated summary + /// file, listed under the `OSTREE_SUMMARY_COLLECTION_MAP` key. Collection IDs + /// and refs in `OSTREE_SUMMARY_COLLECTION_MAP` are guaranteed to be in + /// lexicographic order. + /// + /// Locking: exclusive + /// ## `additional_metadata` + /// A GVariant of type a{sv}, or `None` + /// ## `cancellable` + /// Cancellable fn regenerate_summary<'a, 'b, P: Into>, Q: Into>>(&self, additional_metadata: P, cancellable: Q) -> Result<(), Error>; + /// By default, an `Repo` will cache the remote configuration and its + /// own repo/config data. This API can be used to reload it. + /// ## `cancellable` + /// cancellable fn reload_config<'a, P: Into>>(&self, cancellable: P) -> Result<(), Error>; + /// Create a new remote named `name` pointing to `url`. If `options` is + /// provided, then it will be mapped to `glib::KeyFile` entries, where the + /// GVariant dictionary key is an option string, and the value is + /// mapped as follows: + /// * s: `glib::KeyFile::set_string` + /// * b: `glib::KeyFile::set_boolean` + /// * as: `glib::KeyFile::set_string_list` + /// ## `name` + /// Name of remote + /// ## `url` + /// URL for remote (if URL begins with metalink=, it will be used as such) + /// ## `options` + /// GVariant of type a{sv} + /// ## `cancellable` + /// Cancellable fn remote_add<'a, 'b, P: Into>, Q: Into>>(&self, name: &str, url: &str, options: P, cancellable: Q) -> Result<(), Error>; + /// A combined function handling the equivalent of + /// `RepoExt::remote_add`, `RepoExt::remote_delete`, with more + /// options. + /// ## `sysroot` + /// System root + /// ## `changeop` + /// Operation to perform + /// ## `name` + /// Name of remote + /// ## `url` + /// URL for remote (if URL begins with metalink=, it will be used as such) + /// ## `options` + /// GVariant of type a{sv} + /// ## `cancellable` + /// Cancellable fn remote_change<'a, 'b, 'c, P: IsA + 'a, Q: Into>, R: Into>, S: Into>>(&self, sysroot: Q, changeop: RepoRemoteChange, name: &str, url: &str, options: R, cancellable: S) -> Result<(), Error>; + /// Delete the remote named `name`. It is an error if the provided + /// remote does not exist. + /// ## `name` + /// Name of remote + /// ## `cancellable` + /// Cancellable fn remote_delete<'a, P: Into>>(&self, name: &str, cancellable: P) -> Result<(), Error>; + /// Tries to fetch the summary file and any GPG signatures on the summary file + /// over HTTP, and returns the binary data in `out_summary` and `out_signatures` + /// respectively. + /// + /// If no summary file exists on the remote server, `out_summary` is set to + /// `None`. Likewise if the summary file is not signed, `out_signatures` is + /// set to `None`. In either case the function still returns `true`. + /// + /// This method does not verify the signature of the downloaded summary file. + /// Use `RepoExt::verify_summary` for that. + /// + /// Parse the summary data into a `glib::Variant` using `glib::Variant::new_from_bytes` + /// with `OSTREE_SUMMARY_GVARIANT_FORMAT` as the format string. + /// ## `name` + /// name of a remote + /// ## `out_summary` + /// return location for raw summary data, or + /// `None` + /// ## `out_signatures` + /// return location for raw summary + /// signature data, or `None` + /// ## `cancellable` + /// a `gio::Cancellable` + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn remote_fetch_summary<'a, P: Into>>(&self, name: &str, cancellable: P) -> Result<(glib::Bytes, glib::Bytes), Error>; + /// Like `RepoExt::remote_fetch_summary`, but supports an extensible set of flags. + /// The following are currently defined: + /// + /// - override-url (s): Fetch summary from this URL if remote specifies no metalink in options + /// - http-headers (a(ss)): Additional headers to add to all HTTP requests + /// - append-user-agent (s): Additional string to append to the user agent + /// - n-network-retries (u): Number of times to retry each download on receiving + /// a transient network error, such as a socket timeout; default is 5, 0 + /// means return errors without retrying + /// ## `name` + /// name of a remote + /// ## `options` + /// A GVariant a{sv} with an extensible set of flags + /// ## `out_summary` + /// return location for raw summary data, or + /// `None` + /// ## `out_signatures` + /// return location for raw summary + /// signature data, or `None` + /// ## `cancellable` + /// a `gio::Cancellable` + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn remote_fetch_summary_with_options<'a, 'b, P: Into>, Q: Into>>(&self, name: &str, options: P, cancellable: Q) -> Result<(glib::Bytes, glib::Bytes), Error>; + /// Return whether GPG verification is enabled for the remote named `name` + /// through `out_gpg_verify`. It is an error if the provided remote does + /// not exist. + /// ## `name` + /// Name of remote + /// ## `out_gpg_verify` + /// Remote's GPG option + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn remote_get_gpg_verify(&self, name: &str) -> Result; + /// Return whether GPG verification of the summary is enabled for the remote + /// named `name` through `out_gpg_verify_summary`. It is an error if the provided + /// remote does not exist. + /// ## `name` + /// Name of remote + /// ## `out_gpg_verify_summary` + /// Remote's GPG option + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn remote_get_gpg_verify_summary(&self, name: &str) -> Result; + /// Return the URL of the remote named `name` through `out_url`. It is an + /// error if the provided remote does not exist. + /// ## `name` + /// Name of remote + /// ## `out_url` + /// Remote's URL + /// + /// # Returns + /// + /// `true` on success, `false` on failure fn remote_get_url(&self, name: &str) -> Result; + /// List available remote names in an `Repo`. Remote names are sorted + /// alphabetically. If no remotes are available the function returns `None`. + /// ## `out_n_remotes` + /// Number of remotes available + /// + /// # Returns + /// + /// a `None`-terminated + /// array of remote names fn remote_list(&self) -> Vec; //#[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -253,45 +993,316 @@ pub trait RepoExt { //fn remote_list_refs<'a, P: Into>>(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: P) -> Result<(), Error>; + /// Look up the checksum for the given collection–ref, returning it in `out_rev`. + /// This will search through the mirrors and remote refs. + /// + /// If `allow_noent` is `true` and the given `ref_` cannot be found, `true` will be + /// returned and `out_rev` will be set to `None`. If `allow_noent` is `false` and + /// the given `ref_` cannot be found, a `gio::IOErrorEnum::NotFound` error will be + /// returned. + /// + /// There are currently no `flags` which affect the behaviour of this function. + /// + /// Feature: `v2018_6` + /// + /// ## `ref_` + /// a collection–ref to resolve + /// ## `allow_noent` + /// `true` to not throw an error if `ref_` doesn’t exist + /// ## `flags` + /// options controlling behaviour + /// ## `out_rev` + /// return location for + /// the checksum corresponding to `ref_`, or `None` if `allow_noent` is `true` and + /// the `ref_` could not be found + /// ## `cancellable` + /// a `gio::Cancellable`, or `None` + /// + /// # Returns + /// + /// `true` on success, `false` on failure #[cfg(any(feature = "v2018_6", feature = "dox"))] fn resolve_collection_ref<'a, P: Into>>(&self, ref_: &CollectionRef, allow_noent: bool, flags: RepoResolveRevExtFlags, cancellable: P) -> Result, Error>; + /// Find the GPG keyring for the given `collection_id`, using the local + /// configuration from the given `Repo`. This will search the configured + /// remotes for ones whose `collection-id` key matches `collection_id`, and will + /// return the first matching remote. + /// + /// If multiple remotes match and have different keyrings, a debug message will + /// be emitted, and the first result will be returned. It is expected that the + /// keyrings should match. + /// + /// If no match can be found, a `gio::IOErrorEnum::NotFound` error will be returned. + /// + /// Feature: `v2018_6` + /// + /// ## `collection_id` + /// the collection ID to look up a keyring for + /// ## `cancellable` + /// a `gio::Cancellable`, or `None` + /// + /// # Returns + /// + /// `Remote` containing the GPG keyring for + /// `collection_id` #[cfg(any(feature = "v2018_6", feature = "dox"))] fn resolve_keyring_for_collection<'a, P: Into>>(&self, collection_id: &str, cancellable: P) -> Result; + /// Look up the given refspec, returning the checksum it references in + /// the parameter `out_rev`. Will fall back on remote directory if cannot + /// find the given refspec in local. + /// ## `refspec` + /// A refspec + /// ## `allow_noent` + /// Do not throw an error if refspec does not exist + /// ## `out_rev` + /// A checksum,or `None` if `allow_noent` is true and it does not exist fn resolve_rev(&self, refspec: &str, allow_noent: bool) -> Result; + /// Look up the given refspec, returning the checksum it references in + /// the parameter `out_rev`. Differently from `RepoExt::resolve_rev`, + /// this will not fall back to searching through remote repos if a + /// local ref is specified but not found. + /// ## `refspec` + /// A refspec + /// ## `allow_noent` + /// Do not throw an error if refspec does not exist + /// ## `flags` + /// Options controlling behavior + /// ## `out_rev` + /// A checksum,or `None` if `allow_noent` is true and it does not exist fn resolve_rev_ext(&self, refspec: &str, allow_noent: bool, flags: RepoResolveRevExtFlags) -> Result; + /// This function is deprecated in favor of using `RepoDevInoCache::new`, + /// which allows a precise mapping to be built up between hardlink checkout files + /// and their checksums between `ostree_repo_checkout_at()` and + /// `ostree_repo_write_directory_to_mtree()`. + /// + /// When invoking `RepoExt::write_directory_to_mtree`, it has to compute the + /// checksum of all files. If your commit contains hardlinks from a checkout, + /// this functions builds a mapping of device numbers and inodes to their + /// checksum. + /// + /// There is an upfront cost to creating this mapping, as this will scan the + /// entire objects directory. If your commit is composed of mostly hardlinks to + /// existing ostree objects, then this will speed up considerably, so call it + /// before you call `RepoExt::write_directory_to_mtree` or similar. However, + /// `RepoDevInoCache::new` is better as it avoids scanning all objects. + /// + /// Multithreading: This function is *not* MT safe. + /// ## `cancellable` + /// Cancellable fn scan_hardlinks<'a, P: Into>>(&self, cancellable: P) -> Result<(), Error>; + /// Like `RepoExt::set_ref_immediate`, but creates an alias. + /// ## `remote` + /// A remote for the ref + /// ## `ref_` + /// The ref to write + /// ## `target` + /// The ref target to point it to, or `None` to unset + /// ## `cancellable` + /// GCancellable fn set_alias_ref_immediate<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, remote: P, ref_: &str, target: Q, cancellable: R) -> Result<(), Error>; + /// Set a custom location for the cache directory used for e.g. + /// per-remote summary caches. Setting this manually is useful when + /// doing operations on a system repo as a user because you don't have + /// write permissions in the repo, where the cache is normally stored. + /// ## `dfd` + /// directory fd + /// ## `path` + /// subpath in `dfd` + /// ## `cancellable` + /// a `gio::Cancellable` fn set_cache_dir<'a, P: Into>>(&self, dfd: i32, path: &str, cancellable: P) -> Result<(), Error>; + /// Set or clear the collection ID of this repository. See [collection IDs][collection-ids]. + /// The update will be made in memory, but must be written out to the repository + /// configuration on disk using `RepoExt::write_config`. + /// + /// Feature: `v2018_6` + /// + /// ## `collection_id` + /// new collection ID, or `None` to unset it + /// + /// # Returns + /// + /// `true` on success, `false` otherwise #[cfg(any(feature = "v2018_6", feature = "dox"))] fn set_collection_id<'a, P: Into>>(&self, collection_id: P) -> Result<(), Error>; + /// This is like `RepoExt::transaction_set_collection_ref`, except it may be + /// invoked outside of a transaction. This is presently safe for the + /// case where we're creating or overwriting an existing ref. + /// + /// Feature: `v2018_6` + /// + /// ## `ref_` + /// The collection–ref to write + /// ## `checksum` + /// The checksum to point it to, or `None` to unset + /// ## `cancellable` + /// GCancellable + /// + /// # Returns + /// + /// `true` on success, `false` otherwise #[cfg(any(feature = "v2018_6", feature = "dox"))] fn set_collection_ref_immediate<'a, 'b, P: Into>, Q: Into>>(&self, ref_: &CollectionRef, checksum: P, cancellable: Q) -> Result<(), Error>; + /// Disable requests to `fsync` to stable storage during commits. This + /// option should only be used by build system tools which are creating + /// disposable virtual machines, or have higher level mechanisms for + /// ensuring data consistency. + /// ## `disable_fsync` + /// If `true`, do not fsync fn set_disable_fsync(&self, disable_fsync: bool); + /// This is like `RepoExt::transaction_set_ref`, except it may be + /// invoked outside of a transaction. This is presently safe for the + /// case where we're creating or overwriting an existing ref. + /// + /// Multithreading: This function is MT safe. + /// ## `remote` + /// A remote for the ref + /// ## `ref_` + /// The ref to write + /// ## `checksum` + /// The checksum to point it to, or `None` to unset + /// ## `cancellable` + /// GCancellable fn set_ref_immediate<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, remote: P, ref_: &str, checksum: Q, cancellable: R) -> Result<(), Error>; + /// Add a GPG signature to a commit. + /// ## `commit_checksum` + /// SHA256 of given commit to sign + /// ## `key_id` + /// Use this GPG key id + /// ## `homedir` + /// GPG home directory, or `None` + /// ## `cancellable` + /// A `gio::Cancellable` fn sign_commit<'a, 'b, P: Into>, Q: Into>>(&self, commit_checksum: &str, key_id: &str, homedir: P, cancellable: Q) -> Result<(), Error>; + /// This function is deprecated, sign the summary file instead. + /// Add a GPG signature to a static delta. + /// ## `from_commit` + /// From commit + /// ## `to_commit` + /// To commit + /// ## `key_id` + /// key id + /// ## `homedir` + /// homedir + /// ## `cancellable` + /// cancellable fn sign_delta<'a, P: Into>>(&self, from_commit: &str, to_commit: &str, key_id: &str, homedir: &str, cancellable: P) -> Result<(), Error>; + /// Given a directory representing an already-downloaded static delta + /// on disk, apply it, generating a new commit. The directory must be + /// named with the form "FROM-TO", where both are checksums, and it + /// must contain a file named "superblock", along with at least one part. + /// ## `dir_or_file` + /// Path to a directory containing static delta data, or directly to the superblock + /// ## `skip_validation` + /// If `true`, assume data integrity + /// ## `cancellable` + /// Cancellable fn static_delta_execute_offline<'a, P: IsA, Q: Into>>(&self, dir_or_file: &P, skip_validation: bool, cancellable: Q) -> Result<(), Error>; + /// Generate a lookaside "static delta" from `from` (`None` means + /// from-empty) which can generate the objects in `to`. This delta is + /// an optimization over fetching individual objects, and can be + /// conveniently stored and applied offline. + /// + /// The `params` argument should be an a{sv}. The following attributes + /// are known: + /// - min-fallback-size: u: Minimum uncompressed size in megabytes to use fallback, 0 to disable fallbacks + /// - max-chunk-size: u: Maximum size in megabytes of a delta part + /// - max-bsdiff-size: u: Maximum size in megabytes to consider bsdiff compression + /// for input files + /// - compression: y: Compression type: 0=none, x=lzma, g=gzip + /// - bsdiff-enabled: b: Enable bsdiff compression. Default TRUE. + /// - inline-parts: b: Put part data in header, to get a single file delta. Default FALSE. + /// - verbose: b: Print diagnostic messages. Default FALSE. + /// - endianness: b: Deltas use host byte order by default; this option allows choosing (G_BIG_ENDIAN or G_LITTLE_ENDIAN) + /// - filename: ay: Save delta superblock to this filename, and parts in the same directory. Default saves to repository. + /// ## `opt` + /// High level optimization choice + /// ## `from` + /// ASCII SHA256 checksum of origin, or `None` + /// ## `to` + /// ASCII SHA256 checksum of target + /// ## `metadata` + /// Optional metadata + /// ## `params` + /// Parameters, see below + /// ## `cancellable` + /// Cancellable fn static_delta_generate<'a, 'b, 'c, P: Into>, Q: Into>, R: Into>>(&self, opt: StaticDeltaGenerateOpt, from: &str, to: &str, metadata: P, params: Q, cancellable: R) -> Result<(), Error>; + /// If `checksum` is not `None`, then record it as the target of local ref named + /// `ref_`. + /// + /// Otherwise, if `checksum` is `None`, then record that the ref should + /// be deleted. + /// + /// The change will not be written out immediately, but when the transaction + /// is completed with `RepoExt::commit_transaction`. If the transaction + /// is instead aborted with `RepoExt::abort_transaction`, no changes will + /// be made to the repository. + /// + /// Multithreading: Since v2017.15 this function is MT safe. + /// + /// Feature: `v2018_6` + /// + /// ## `ref_` + /// The collection–ref to write + /// ## `checksum` + /// The checksum to point it to #[cfg(any(feature = "v2018_6", feature = "dox"))] fn transaction_set_collection_ref<'a, P: Into>>(&self, ref_: &CollectionRef, checksum: P); + /// If `checksum` is not `None`, then record it as the target of ref named + /// `ref_`; if `remote` is provided, the ref will appear to originate from that + /// remote. + /// + /// Otherwise, if `checksum` is `None`, then record that the ref should + /// be deleted. + /// + /// The change will be written when the transaction is completed with + /// `RepoExt::commit_transaction`; that function takes care of writing all of + /// the objects (such as the commit referred to by `checksum`) before updating the + /// refs. If the transaction is instead aborted with + /// `RepoExt::abort_transaction`, no changes to the ref will be made to the + /// repository. + /// + /// Note however that currently writing *multiple* refs is not truly atomic; if + /// the process or system is terminated during + /// `RepoExt::commit_transaction`, it is possible that just some of the refs + /// will have been updated. Your application should take care to handle this + /// case. + /// + /// Multithreading: Since v2017.15 this function is MT safe. + /// ## `remote` + /// A remote for the ref + /// ## `ref_` + /// The ref to write + /// ## `checksum` + /// The checksum to point it to fn transaction_set_ref<'a, 'b, P: Into>, Q: Into>>(&self, remote: P, ref_: &str, checksum: Q); + /// Like `RepoExt::transaction_set_ref`, but takes concatenated + /// `refspec` format as input instead of separate remote and name + /// arguments. + /// + /// Multithreading: Since v2017.15 this function is MT safe. + /// ## `refspec` + /// The refspec to write + /// ## `checksum` + /// The checksum to point it to fn transaction_set_refspec<'a, P: Into>>(&self, refspec: &str, checksum: P); //fn traverse_commit<'a, P: Into>>(&self, commit_checksum: &str, maxdepth: i32, out_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 181 }/TypeId { ns_id: 2, id: 181 }, cancellable: P) -> Result<(), Error>; @@ -304,44 +1315,235 @@ pub trait RepoExt { //#[cfg(any(feature = "v2018_6", feature = "dox"))] //fn traverse_reachable_refs<'a, P: Into>>(&self, depth: u32, reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 181 }/TypeId { ns_id: 2, id: 181 }, cancellable: P) -> Result<(), Error>; + /// Check for a valid GPG signature on commit named by the ASCII + /// checksum `commit_checksum`. + /// ## `commit_checksum` + /// ASCII SHA256 checksum + /// ## `keyringdir` + /// Path to directory GPG keyrings; overrides built-in default if given + /// ## `extra_keyring` + /// Path to additional keyring file (not a directory) + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// `true` if there was a GPG signature from a trusted keyring, otherwise `false` fn verify_commit<'a, 'b, 'c, P: IsA + 'a, Q: Into>, R: IsA + 'b, S: Into>, T: Into>>(&self, commit_checksum: &str, keyringdir: Q, extra_keyring: S, cancellable: T) -> Result<(), Error>; + /// Read GPG signature(s) on the commit named by the ASCII checksum + /// `commit_checksum` and return detailed results. + /// ## `commit_checksum` + /// ASCII SHA256 checksum + /// ## `keyringdir` + /// Path to directory GPG keyrings; overrides built-in default if given + /// ## `extra_keyring` + /// Path to additional keyring file (not a directory) + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// an `GpgVerifyResult`, or `None` on error fn verify_commit_ext<'a, 'b, 'c, P: IsA + 'a, Q: Into>, R: IsA + 'b, S: Into>, T: Into>>(&self, commit_checksum: &str, keyringdir: Q, extra_keyring: S, cancellable: T) -> Result; + /// Read GPG signature(s) on the commit named by the ASCII checksum + /// `commit_checksum` and return detailed results, based on the keyring + /// configured for `remote`. + /// ## `commit_checksum` + /// ASCII SHA256 checksum + /// ## `remote_name` + /// OSTree remote to use for configuration + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// an `GpgVerifyResult`, or `None` on error fn verify_commit_for_remote<'a, P: Into>>(&self, commit_checksum: &str, remote_name: &str, cancellable: P) -> Result; + /// Verify `signatures` for `summary` data using GPG keys in the keyring for + /// `remote_name`, and return an `GpgVerifyResult`. + /// ## `remote_name` + /// Name of remote + /// ## `summary` + /// Summary data as a `glib::Bytes` + /// ## `signatures` + /// Summary signatures as a `glib::Bytes` + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// an `GpgVerifyResult`, or `None` on error fn verify_summary<'a, P: Into>>(&self, remote_name: &str, summary: &glib::Bytes, signatures: &glib::Bytes, cancellable: P) -> Result; + /// Import an archive file `archive` into the repository, and write its + /// file structure to `mtree`. + /// ## `archive` + /// A path to an archive file + /// ## `mtree` + /// The `MutableTree` to write to + /// ## `modifier` + /// Optional commit modifier + /// ## `autocreate_parents` + /// Autocreate parent directories + /// ## `cancellable` + /// Cancellable fn write_archive_to_mtree<'a, 'b, P: IsA, Q: Into>, R: Into>>(&self, archive: &P, mtree: &MutableTree, modifier: Q, autocreate_parents: bool, cancellable: R) -> Result<(), Error>; + /// Write a commit metadata object, referencing `root_contents_checksum` + /// and `root_metadata_checksum`. + /// ## `parent` + /// ASCII SHA256 checksum for parent, or `None` for none + /// ## `subject` + /// Subject + /// ## `body` + /// Body + /// ## `metadata` + /// GVariant of type a{sv}, or `None` for none + /// ## `root` + /// The tree to point the commit to + /// ## `out_commit` + /// Resulting ASCII SHA256 checksum for commit + /// ## `cancellable` + /// Cancellable fn write_commit<'a, 'b, 'c, 'd, 'e, P: Into>, Q: Into>, R: Into>, S: Into>, T: Into>>(&self, parent: P, subject: Q, body: R, metadata: S, root: &RepoFile, cancellable: T) -> Result; + /// Replace any existing metadata associated with commit referred to by + /// `checksum` with `metadata`. If `metadata` is `None`, then existing + /// data will be deleted. + /// ## `checksum` + /// ASCII SHA256 commit checksum + /// ## `metadata` + /// Metadata to associate with commit in with format "a{sv}", or `None` to delete + /// ## `cancellable` + /// Cancellable fn write_commit_detached_metadata<'a, 'b, P: Into>, Q: Into>>(&self, checksum: &str, metadata: P, cancellable: Q) -> Result<(), Error>; + /// Write a commit metadata object, referencing `root_contents_checksum` + /// and `root_metadata_checksum`. + /// ## `parent` + /// ASCII SHA256 checksum for parent, or `None` for none + /// ## `subject` + /// Subject + /// ## `body` + /// Body + /// ## `metadata` + /// GVariant of type a{sv}, or `None` for none + /// ## `root` + /// The tree to point the commit to + /// ## `time` + /// The time to use to stamp the commit + /// ## `out_commit` + /// Resulting ASCII SHA256 checksum for commit + /// ## `cancellable` + /// Cancellable fn write_commit_with_time<'a, 'b, 'c, 'd, 'e, P: Into>, Q: Into>, R: Into>, S: Into>, T: Into>>(&self, parent: P, subject: Q, body: R, metadata: S, root: &RepoFile, time: u64, cancellable: T) -> Result; + /// Save `new_config` in place of this repository's config file. + /// ## `new_config` + /// Overwrite the config file with this data fn write_config(&self, new_config: &glib::KeyFile) -> Result<(), Error>; //fn write_content<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, expected_checksum: P, object_input: &Q, length: u64, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: R) -> Result<(), Error>; + /// Store the content object streamed as `object_input`, with total + /// length `length`. The given `checksum` will be treated as trusted. + /// + /// This function should be used when importing file objects from local + /// disk, for example. + /// ## `checksum` + /// Store content using this ASCII SHA256 checksum + /// ## `object_input` + /// Content stream + /// ## `length` + /// Length of `object_input` + /// ## `cancellable` + /// Cancellable fn write_content_trusted<'a, P: IsA, Q: Into>>(&self, checksum: &str, object_input: &P, length: u64, cancellable: Q) -> Result<(), Error>; + /// Store as objects all contents of the directory referred to by `dfd` + /// and `path` all children into the repository `self`, overlaying the + /// resulting filesystem hierarchy into `mtree`. + /// ## `dfd` + /// Directory file descriptor + /// ## `path` + /// Path + /// ## `mtree` + /// Overlay directory contents into this tree + /// ## `modifier` + /// Optional modifier + /// ## `cancellable` + /// Cancellable fn write_dfd_to_mtree<'a, 'b, P: Into>, Q: Into>>(&self, dfd: i32, path: &str, mtree: &MutableTree, modifier: P, cancellable: Q) -> Result<(), Error>; + /// Store objects for `dir` and all children into the repository `self`, + /// overlaying the resulting filesystem hierarchy into `mtree`. + /// ## `dir` + /// Path to a directory + /// ## `mtree` + /// Overlay directory contents into this tree + /// ## `modifier` + /// Optional modifier + /// ## `cancellable` + /// Cancellable fn write_directory_to_mtree<'a, 'b, P: IsA, Q: Into>, R: Into>>(&self, dir: &P, mtree: &MutableTree, modifier: Q, cancellable: R) -> Result<(), Error>; //fn write_metadata<'a, 'b, P: Into>, Q: Into>>(&self, objtype: ObjectType, expected_checksum: P, object: &glib::Variant, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: Q) -> Result<(), Error>; + /// Store the metadata object `variant`; the provided `checksum` is + /// trusted. + /// ## `objtype` + /// Object type + /// ## `checksum` + /// Store object with this ASCII SHA256 checksum + /// ## `object_input` + /// Metadata object stream + /// ## `length` + /// Length, may be 0 for unknown + /// ## `cancellable` + /// Cancellable fn write_metadata_stream_trusted<'a, P: IsA, Q: Into>>(&self, objtype: ObjectType, checksum: &str, object_input: &P, length: u64, cancellable: Q) -> Result<(), Error>; + /// Store the metadata object `variant`; the provided `checksum` is + /// trusted. + /// ## `objtype` + /// Object type + /// ## `checksum` + /// Store object with this ASCII SHA256 checksum + /// ## `variant` + /// Metadata object + /// ## `cancellable` + /// Cancellable fn write_metadata_trusted<'a, P: Into>>(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: P) -> Result<(), Error>; + /// Write all metadata objects for `mtree` to repo; the resulting + /// `out_file` points to the `ObjectType::DirTree` object that + /// the `mtree` represented. + /// ## `mtree` + /// Mutable tree + /// ## `out_file` + /// An `RepoFile` representing `mtree`'s root. + /// ## `cancellable` + /// Cancellable fn write_mtree<'a, P: Into>>(&self, mtree: &MutableTree, cancellable: P) -> Result; fn get_property_remotes_config_dir(&self) -> Option; fn get_property_sysroot_path(&self) -> Option; + /// Emitted during a pull operation upon GPG verification (if enabled). + /// Applications can connect to this signal to output the verification + /// results if desired. + /// + /// The signal will be emitted from whichever `glib::MainContext` is the + /// thread-default at the point when `RepoExt::pull_with_options` + /// is called. + /// ## `checksum` + /// checksum of the signed object + /// ## `result` + /// an `GpgVerifyResult` fn connect_gpg_verify_result(&self, f: F) -> SignalHandlerId; } diff --git a/rust-bindings/rust/libostree/src/auto/repo_commit_modifier.rs b/rust-bindings/rust/libostree/src/auto/repo_commit_modifier.rs index 5e492fac..e79e6876 100644 --- a/rust-bindings/rust/libostree/src/auto/repo_commit_modifier.rs +++ b/rust-bindings/rust/libostree/src/auto/repo_commit_modifier.rs @@ -28,6 +28,21 @@ impl RepoCommitModifier { // unsafe { TODO: call ffi::ostree_repo_commit_modifier_new() } //} + /// See the documentation for + /// `ostree_repo_devino_cache_new()`. This function can + /// then be used for later calls to + /// `ostree_repo_write_directory_to_mtree()` to optimize commits. + /// + /// Note if your process has multiple writers, you should use separate + /// `OSTreeRepo` instances if you want to also use this API. + /// + /// This function will add a reference to `cache` without copying - you + /// should avoid further mutation of the cache. + /// + /// Feature: `v2017_13` + /// + /// ## `cache` + /// A hash table caching device,inode to checksums #[cfg(any(feature = "v2017_13", feature = "dox"))] pub fn set_devino_cache(&self, cache: &RepoDevInoCache) { unsafe { @@ -35,6 +50,16 @@ impl RepoCommitModifier { } } + /// If `policy` is non-`None`, use it to look up labels to use for + /// "security.selinux" extended attributes. + /// + /// Note that any policy specified this way operates in addition to any + /// extended attributes provided via + /// `RepoCommitModifier::set_xattr_callback`. However if both + /// specify a value for "security.selinux", then the one from the + /// policy wins. + /// ## `sepolicy` + /// Policy to use for labeling pub fn set_sepolicy<'a, P: Into>>(&self, sepolicy: P) { let sepolicy = sepolicy.into(); let sepolicy = sepolicy.to_glib_none(); diff --git a/rust-bindings/rust/libostree/src/auto/repo_dev_ino_cache.rs b/rust-bindings/rust/libostree/src/auto/repo_dev_ino_cache.rs index 7ffd9f0c..8d00c174 100644 --- a/rust-bindings/rust/libostree/src/auto/repo_dev_ino_cache.rs +++ b/rust-bindings/rust/libostree/src/auto/repo_dev_ino_cache.rs @@ -21,6 +21,17 @@ glib_wrapper! { } impl RepoDevInoCache { + /// OSTree has support for pairing `RepoExt::checkout_tree_at` using + /// hardlinks in combination with a later + /// `RepoExt::write_directory_to_mtree` using a (normally modified) + /// directory. In order for OSTree to optimally detect just the new + /// files, use this function and fill in the `devino_to_csum_cache` + /// member of `OstreeRepoCheckoutAtOptions`, then call + /// `ostree_repo_commit_set_devino_cache`. + /// + /// # Returns + /// + /// Newly allocated cache pub fn new() -> RepoDevInoCache { unsafe { from_glib_full(ffi::ostree_repo_devino_cache_new()) diff --git a/rust-bindings/rust/libostree/src/auto/repo_file.rs b/rust-bindings/rust/libostree/src/auto/repo_file.rs index 17b06596..eed32005 100644 --- a/rust-bindings/rust/libostree/src/auto/repo_file.rs +++ b/rust-bindings/rust/libostree/src/auto/repo_file.rs @@ -25,13 +25,26 @@ glib_wrapper! { } } +/// Trait containing all `RepoFile` methods. +/// +/// # Implementors +/// +/// [`RepoFile`](struct.RepoFile.html) pub trait RepoFileExt { fn ensure_resolved(&self) -> Result<(), Error>; fn get_checksum(&self) -> Option; + /// + /// # Returns + /// + /// Repository fn get_repo(&self) -> Option; + /// + /// # Returns + /// + /// The root directory for the commit referenced by this file fn get_root(&self) -> Option; fn tree_get_contents(&self) -> Option; diff --git a/rust-bindings/rust/libostree/src/auto/se_policy.rs b/rust-bindings/rust/libostree/src/auto/se_policy.rs index fe17535f..fa46f462 100644 --- a/rust-bindings/rust/libostree/src/auto/se_policy.rs +++ b/rust-bindings/rust/libostree/src/auto/se_policy.rs @@ -25,6 +25,14 @@ glib_wrapper! { } impl SePolicy { + /// ## `path` + /// Path to a root directory + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// An accessor object for SELinux policy in root located at `path` pub fn new<'a, P: IsA, Q: Into>>(path: &P, cancellable: Q) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); @@ -35,6 +43,14 @@ impl SePolicy { } } + /// ## `rootfs_dfd` + /// Directory fd for rootfs (will not be cloned) + /// ## `cancellable` + /// Cancellable + /// + /// # Returns + /// + /// An accessor object for SELinux policy in root located at `rootfs_dfd` pub fn new_at<'a, P: Into>>(rootfs_dfd: i32, cancellable: P) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); @@ -50,17 +66,62 @@ impl SePolicy { //} } +/// Trait containing all `SePolicy` methods. +/// +/// # Implementors +/// +/// [`SePolicy`](struct.SePolicy.html) pub trait SePolicyExt { + /// + /// # Returns + /// + /// Checksum of current policy fn get_csum(&self) -> Option; + /// Store in `out_label` the security context for the given `relpath` and + /// mode `unix_mode`. If the policy does not specify a label, `None` + /// will be returned. + /// ## `relpath` + /// Path + /// ## `unix_mode` + /// Unix mode + /// ## `out_label` + /// Return location for security context + /// ## `cancellable` + /// Cancellable fn get_label<'a, P: Into>>(&self, relpath: &str, unix_mode: u32, cancellable: P) -> Result; + /// + /// # Returns + /// + /// Type of current policy fn get_name(&self) -> Option; + /// + /// # Returns + /// + /// Path to rootfs fn get_path(&self) -> Option; + /// Reset the security context of `target` based on the SELinux policy. + /// ## `path` + /// Path string to use for policy lookup + /// ## `info` + /// File attributes + /// ## `target` + /// Physical path to target file + /// ## `flags` + /// Flags controlling behavior + /// ## `out_new_label` + /// New label, or `None` if unchanged + /// ## `cancellable` + /// Cancellable fn restorecon<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, path: &str, info: P, target: &Q, flags: SePolicyRestoreconFlags, cancellable: R) -> Result; + /// ## `path` + /// Use this path to determine a label + /// ## `mode` + /// Used along with `path` fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), Error>; fn get_property_rootfs_dfd(&self) -> i32;