ostree-misc-experimental 3 OSTREE Library
ostree-misc-experimental

## Functions

const gchar * | ostree_repo_get_collection_id ()
gboolean | ostree_repo_set_collection_id ()
gboolean | ostree_validate_collection_id ()
gboolean | ostree_repo_list_collection_refs ()
gboolean | ostree_repo_remote_list_collection_refs ()
gboolean | ostree_repo_set_collection_ref_immediate ()
void | ostree_repo_transaction_set_collection_ref ()
gboolean | ostree_repo_resolve_collection_ref ()

## Description

## Functions

### ostree_repo_get_collection_id ()

    const gchar *
    ostree_repo_get_collection_id (OstreeRepo *self);

Get the collection ID of this repository. See collection IDs.

#### Parameters

self | an OstreeRepo |

#### Returns

collection ID for the repository.

[nullable]

Since: 2018.6

ostree_repo_get_collection_id

### ostree_repo_set_collection_id ()

    gboolean
    ostree_repo_set_collection_id (OstreeRepo *self,
                                   const gchar *collection_id,
                                   GError **error);

Set or clear the collection ID of this repository. See collection IDs. The update will be made in memory, but must be written out to the repository configuration on disk using `ostree_repo_write_config()`.

#### Parameters

self | an OstreeRepo |
collection_id | new collection ID, or `NULL` to unset it. | [nullable]
error | return location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` otherwise

Since: 2018.6

ostree_repo_set_collection_id

### ostree_validate_collection_id ()

    gboolean
    ostree_validate_collection_id (const char *collection_id,
                                   GError **error);

Check whether the given collection_id is valid. Return an error if it is invalid or `NULL`.

Valid collection IDs are reverse DNS names:

- They are composed of 1 or more elements separated by a period (`.`) character. All elements must contain at least one character.

- Each element must only contain the ASCII characters `[A-Z][a-z][0-9]_` and must not begin with a digit.

- They must contain at least one `.` (period) character (and thus at least two elements).

- They must not begin with a `.` (period) character.

- They must not exceed 255 characters in length.

(This makes their format identical to D-Bus interface names, for consistency.)

#### Parameters

collection_id | A collection ID. | [nullable]
error | Error |

#### Returns

`TRUE` if collection_id is a valid collection ID, `FALSE` if it is invalid or `NULL`

Since: 2018.6

ostree_validate_collection_id

### ostree_repo_list_collection_refs ()

    gboolean
    ostree_repo_list_collection_refs (OstreeRepo *self,
                                      const char *match_collection_id,
                                      GHashTable **out_all_refs,
                                      OstreeRepoListRefsExtFlags flags,
                                      GCancellable *cancellable,
                                      GError **error);

List all local, mirrored, and remote refs, mapping them to the commit checksums they currently point to in out_all_refs . If match_collection_id is specified, the results will be limited to those with an equal collection ID.

OstreeCollectionRefs are guaranteed to be returned with their collection ID set to a non-`NULL` value; so no refs from `refs/heads` will be listed if no collection ID is configured for the repository (`ostree_repo_get_collection_id()`).

If you want to exclude refs from `refs/remotes`, use `OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES` in flags . Similarly use `OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS` to exclude refs from `refs/mirrors`.

#### Parameters

self | Repo |
match_collection_id | If non-`NULL`, only list refs from this collection. | [nullable]
out_all_refs | Mapping from collection–ref to checksum. | [out][element-type OstreeCollectionRef utf8][transfer container]
flags | Options controlling listing behavior |
cancellable | Cancellable |
error | Error |

#### Returns

`TRUE` on success, `FALSE` otherwise

Since: 2018.6

ostree_repo_list_collection_refs

### ostree_repo_remote_list_collection_refs ()

    gboolean
    ostree_repo_remote_list_collection_refs
                                   (OstreeRepo *self,
                                    const char *remote_name,
                                    GHashTable **out_all_refs,
                                    GCancellable *cancellable,
                                    GError **error);

List refs advertised by remote_name , including refs which are part of collections. If the repository at remote_name has a collection ID set, its refs will be returned with that collection ID; otherwise, they will be returned with a `NULL` collection ID in each OstreeCollectionRef key in out_all_refs . Any refs for other collections stored in the repository will also be returned. No filtering is performed.

#### Parameters

self | Repo |
remote_name | Name of the remote. |
out_all_refs | Mapping from collection–ref to checksum. | [out][element-type OstreeCollectionRef utf8][transfer container]
cancellable | Cancellable |
error | Error |

Since: 2018.6

ostree_repo_remote_list_collection_refs

### ostree_repo_set_collection_ref_immediate ()

    gboolean
    ostree_repo_set_collection_ref_immediate
                                   (OstreeRepo *self,
                                    const OstreeCollectionRef *ref,
                                    const char *checksum,
                                    GCancellable *cancellable,
                                    GError **error);

This is like `ostree_repo_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.

#### Parameters

self | An OstreeRepo |
ref | The collection–ref to write |
checksum | The checksum to point it to, or `NULL` to unset. | [nullable]
cancellable | GCancellable |
error | GError |

#### Returns

`TRUE` on success, `FALSE` otherwise

Since: 2018.6

ostree_repo_set_collection_ref_immediate

### ostree_repo_transaction_set_collection_ref ()

    void
    ostree_repo_transaction_set_collection_ref
                                   (OstreeRepo *self,
                                    const OstreeCollectionRef *ref,
                                    const char *checksum);

If checksum is not `NULL`, then record it as the target of local ref named ref .

Otherwise, if checksum is `NULL`, then record that the ref should be deleted.

The change will not be written out immediately, but when the transaction is completed with `ostree_repo_commit_transaction()`. If the transaction is instead aborted with `ostree_repo_abort_transaction()`, no changes will be made to the repository.

Multithreading: Since v2017.15 this function is MT safe.

#### Parameters

self | An OstreeRepo |
ref | The collection–ref to write |
checksum | The checksum to point it to. | [nullable]

Since: 2018.6

ostree_repo_transaction_set_collection_ref

### ostree_repo_resolve_collection_ref ()

    gboolean
    ostree_repo_resolve_collection_ref (OstreeRepo *self,
                                        const OstreeCollectionRef *ref,
                                        gboolean allow_noent,
                                        OstreeRepoResolveRevExtFlags flags,
                                        char **out_rev,
                                        GCancellable *cancellable,
                                        GError **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 `NULL`. If allow_noent is `FALSE` and the given ref cannot be found, a `G_IO_ERROR_NOT_FOUND` error will be returned.

If you want to check only local refs, not remote or mirrored ones, use the flag `OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY`. This is analogous to using `ostree_repo_resolve_rev_ext()` but for collection-refs.

#### Parameters

self | an OstreeRepo |
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 `NULL` if allow_noent is `TRUE` and the ref could not be found. | [out][transfer full][optional][nullable]
cancellable | a GCancellable, or `NULL`. | [nullable]
error | return location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` on failure

Since: 2018.6

ostree_repo_resolve_collection_ref