Documentation ¶
Index ¶
- Constants
- func GoError(e *C.GError) error
- type Err
- type FlagSet
- type ListRefsExtFlags
- type Option
- func AppendUserAgent(appendUserAgent string) Option
- func Depth(depth int) Option
- func DisableStaticDelta() Option
- func DryRun() Option
- func Flags(flags FlagSet) Option
- func HTTPHeaders(headers map[string]string) Option
- func MaxOutstandingFetcherRequests(n uint32) Option
- func NetworkRetries(n int) Option
- func NoGPGVerify() Option
- func NoGPGVerifySummary() Option
- func Refs(refs ...string) Option
- func RequireStaticDelta() Option
- type Ref
- type Repo
- func (r *Repo) AddRemote(name, url string, opts ...Option) error
- func (r *Repo) DeleteRemote(name string) error
- func (r *Repo) ListRefsExt(flags ListRefsExtFlags, prefix ...string) ([]Ref, error)
- func (r *Repo) ListRemotes() []string
- func (r *Repo) Pull(ctx context.Context, remote string, opts ...Option) error
- func (r *Repo) RegenerateSummary() error
- func (r *Repo) ReloadRemoteConfig() error
- type RepoMode
Constants ¶
const ( // Mirror - Write out refs suitable for mirrors and fetch all refs if none requested Mirror = 1 << iota // CommitOnly - Fetch only the commit metadata CommitOnly // Untrusted - Do verify checksums of local (filesystem-accessible) repositories (defaults on for HTTP) Untrusted // BaseUserOnlyFiles - Since 2017.7. Reject writes of content objects with modes outside of 0775. BaseUserOnlyFiles // TrustedHTTP - Don't verify checksums of objects HTTP repositories (Since: 2017.12) TrustedHTTP // None - No special options for pull None = 0 )
const ( ListRefsExtFlagsAliases = 1 << iota ListRefsExtFlagsExcludeRemotes ListRefsExtFlagsExcludeMirrors ListRefsExtFlagsNone ListRefsExtFlags = 0 )
const (
ErrInvalidPath = Err("invalid path")
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ListRefsExtFlags ¶
type ListRefsExtFlags int
type Option ¶
type Option func(builder *C.GVariantBuilder, deferFree deferredFreeFn)
Option defines an option for pulling ostree repos. It is used to build a *C.GVariant via a *C.GVariantBuilder. deferFree is an optional function that frees the memory allocated by the option. deferFree may be called more than once.
func AppendUserAgent ¶
AppendUserAgent sets the append-user-agent option to the given value in the pull options. Additional string to append to the user agent.
func Depth ¶
Depth sets the depth option to the given value in the pull options. How far in the history to traverse; default is 0, -1 means infinite
func DisableStaticDelta ¶
func DisableStaticDelta() Option
DisableStaticDelta sets the disable-static-deltas option to true in the pull options. Do not use static deltas.
func DryRun ¶
func DryRun() Option
DryRun sets the dry-run option to true in the pull options. Only print information on what will be downloaded (requires static deltas).
func HTTPHeaders ¶ added in v0.0.30
HTTPHeaders sets the http-headers option to the given value in the pull options. Additional HTTP headers to send with requests.
func MaxOutstandingFetcherRequests ¶ added in v0.0.30
MaxOutstandingFetcherRequests sets the max-outstanding-fetcher-requests option to the given value in the pull options. The max amount of concurrent connections allowed.
func NetworkRetries ¶
NetworkRetries sets the n-network-retries option to the given value in the pull options. Number of times to retry each download on receiving.
func NoGPGVerify ¶
func NoGPGVerify() Option
NoGPGVerify sets the gpg-verify option to false in the pull options.
func NoGPGVerifySummary ¶
func NoGPGVerifySummary() Option
NoGPGVerifySummary sets the gpg-verify-summary option to false in the pull options.
func Refs ¶
Refs adds the given refs to the pull options. When pulling refs from a remote, only the specified refs will be pulled.
func RequireStaticDelta ¶
func RequireStaticDelta() Option
RequireStaticDelta sets the require-static-deltas option to true in the pull options. Require static deltas.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func Init ¶
Init initializes & opens a new ostree repository at the given path.
Create the underlying structure on disk for the repository, and call ostree_repo_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 ostree_repo_create_at(). It is an error to call this function on a repository initialized via ostree_repo_open_at().
func (*Repo) DeleteRemote ¶
DeleteRemote deletes a remote from the repository.
func (*Repo) ListRefsExt ¶
func (r *Repo) ListRefsExt(flags ListRefsExtFlags, prefix ...string) ([]Ref, error)
func (*Repo) ListRemotes ¶
ListRemotes lists the remotes in the repository.
func (*Repo) Pull ¶
Pull pulls refs from the named remote. Returns an error if the refs could not be fetched.
func (*Repo) RegenerateSummary ¶
func (*Repo) ReloadRemoteConfig ¶
ReloadRemoteConfig reloads the remote configuration.
type RepoMode ¶
type RepoMode string
RepoMode - The mode to use when creating a new repo. If an unknown mode is passed, RepoModeBare will be used silently.
See https://ostreedev.github.io/ostree/formats/#the-archive-format See https://ostreedev.github.io/ostree/formats/#aside-bare-formats
const ( // RepoModeBare - The default mode. Keeps all file metadata. May require elevated privileges. // The bare repository format is the simplest one. In this mode regular files are directly stored to disk, and all // metadata (e.g. uid/gid and xattrs) is reflected to the filesystem. It allows further direct access to content and // metadata, but it may require elevated privileges when writing objects to the repository. RepoModeBare RepoMode = "bare" // RepoModeArchive - The archive format. Best for small storage footprint. Mostly used for server-side repositories. // The archive format simply gzip-compresses each content object. Metadata objects are stored uncompressed. This // means that it’s easy to serve via static HTTP. Note: the repo config file still uses the historical term // archive-z2 as mode. But this essentially indicates the modern archive format. // // When you commit new content, you will see new .filez files appearing in `objects/`. RepoModeArchive RepoMode = "archive" // RepoModeArchiveZ2 - Functionally equivalent to RepoModeArchive. Only useful for backwards compatibility. RepoModeArchiveZ2 RepoMode = "archive-z2" // RepoModeBareUser - Like RepoModeBare but ignore incoming uid/gid and xattrs. // The bare-user format is a bit special in that the uid/gid and xattrs from the content are ignored. This is // primarily useful if you want to have the same OSTree-managed content that can be run on a host system or an // unprivileged container. RepoModeBareUser RepoMode = "bare-user" // RepoModeBareUserOnly - Like RepoModeBareUser. No metadata stored. Only useful for checkouts. Does not need xattrs. // Same as BARE_USER, but all metadata is not stored, so it can only be used for user checkouts. Does not need xattrs. RepoModeBareUserOnly RepoMode = "bare-user-only" // RepoModeBareSplitXAttrs - Like RepoModeBare but store xattrs in a separate file. // Similarly, the bare-split-xattrs format is a special mode where xattrs are stored as separate repository objects, // and not directly reflected to the filesystem. This is primarily useful when transporting xattrs through lossy // environments (e.g. tar streams and containerized environments). It also allows carrying security-sensitive xattrs // (e.g. SELinux labels) out-of-band without involving OS filesystem logic. RepoModeBareSplitXAttrs RepoMode = "bare-split-xattrs" )