package flatpak

import "git.sr.ht/~erazemk/go-flatpak/pkg/flatpak"

Index

Constants

const MAJOR_VERSION = 1

MAJOR_VERSION: major version.

const MICRO_VERSION = 7

MICRO_VERSION: micro version.

const MINOR_VERSION = 12

MINOR_VERSION: minor version.

Variables

var (
	GTypeStorageType    = externglib.Type(C.flatpak_storage_type_get_type())
	GTypeInstallFlags   = externglib.Type(C.flatpak_install_flags_get_type())
	GTypeLaunchFlags    = externglib.Type(C.flatpak_launch_flags_get_type())
	GTypeQueryFlags     = externglib.Type(C.flatpak_query_flags_get_type())
	GTypeUninstallFlags = externglib.Type(C.flatpak_uninstall_flags_get_type())
	GTypeUpdateFlags    = externglib.Type(C.flatpak_update_flags_get_type())
	GTypeInstallation   = externglib.Type(C.flatpak_installation_get_type())
)

glib.Type values for flatpak-installation.go.

var (
	GTypeRefKind = externglib.Type(C.flatpak_ref_kind_get_type())
	GTypeRef     = externglib.Type(C.flatpak_ref_get_type())
)

glib.Type values for flatpak-ref.go.

var (
	GTypeRemoteType = externglib.Type(C.flatpak_remote_type_get_type())
	GTypeRemote     = externglib.Type(C.flatpak_remote_get_type())
)

glib.Type values for flatpak-remote.go.

var (
	GTypeTransactionOperationType = externglib.Type(C.flatpak_transaction_operation_type_get_type())
	GTypeTransactionRemoteReason  = externglib.Type(C.flatpak_transaction_remote_reason_get_type())
	GTypeTransactionErrorDetails  = externglib.Type(C.flatpak_transaction_error_details_get_type())
	GTypeTransactionResult        = externglib.Type(C.flatpak_transaction_result_get_type())
	GTypeTransaction              = externglib.Type(C.flatpak_transaction_get_type())
	GTypeTransactionOperation     = externglib.Type(C.flatpak_transaction_operation_get_type())
	GTypeTransactionProgress      = externglib.Type(C.flatpak_transaction_progress_get_type())
)

glib.Type values for flatpak-transaction.go.

var GTypeBundleRef = externglib.Type(C.flatpak_bundle_ref_get_type())

glib.Type values for flatpak-bundle-ref.go.

var GTypeError = externglib.Type(C.flatpak_error_get_type())

glib.Type values for flatpak-error.go.

var GTypeInstalledRef = externglib.Type(C.flatpak_installed_ref_get_type())

glib.Type values for flatpak-installed-ref.go.

var GTypeInstance = externglib.Type(C.flatpak_instance_get_type())

glib.Type values for flatpak-instance.go.

var GTypePortalError = externglib.Type(C.flatpak_portal_error_get_type())

glib.Type values for flatpak-portal-error.go.

var GTypeRelatedRef = externglib.Type(C.flatpak_related_ref_get_type())

glib.Type values for flatpak-related-ref.go.

var GTypeRemoteRef = externglib.Type(C.flatpak_remote_ref_get_type())

glib.Type values for flatpak-remote-ref.go.

Functions

func ErrorQuark

func ErrorQuark() glib.Quark

The function returns the following values:

func GetDefaultArch

func GetDefaultArch() string

GetDefaultArch returns the canonical name for the arch of the current machine.

The function returns the following values:

func GetSupportedArches

func GetSupportedArches() []string

GetSupportedArches returns the canonical names for the arches that are supported (i.e. can run) on the current machine, in order of priority (default is first).

The function returns the following values:

func PortalErrorQuark

func PortalErrorQuark() glib.Quark

The function returns the following values:

func TransactionOperationTypeToString

func TransactionOperationTypeToString(kind TransactionOperationType) string

TransactionOperationTypeToString converts the operation type to a string.

The function takes the following parameters:

The function returns the following values:

Types

type BundleRef

type BundleRef struct {
	Ref
	// contains filtered or unexported fields
}

func NewBundleRef

func NewBundleRef(file gio.Filer) (*BundleRef, error)

NewBundleRef creates a new bundle ref for the given file.

The function takes the following parameters:

The function returns the following values:

func (*BundleRef) Appstream

func (self *BundleRef) Appstream() *glib.Bytes

Appstream: get the compressed appstream for the app/runtime.

The function returns the following values:

func (*BundleRef) File

func (self *BundleRef) File() *gio.File

File: get the file this bundle is stored in.

The function returns the following values:

func (*BundleRef) Icon

func (self *BundleRef) Icon(size int) *glib.Bytes

Icon: get the icon png data for the app/runtime.

The function takes the following parameters:

The function returns the following values:

func (*BundleRef) InstalledSize

func (self *BundleRef) InstalledSize() uint64

InstalledSize returns the installed size for the bundle.

The function returns the following values:

func (*BundleRef) Metadata

func (self *BundleRef) Metadata() *glib.Bytes

Metadata: get the metadata for the app/runtime.

The function returns the following values:

func (*BundleRef) Origin

func (self *BundleRef) Origin() string

Origin: get the origin url stored in the bundle.

The function returns the following values:

func (*BundleRef) RuntimeRepoURL

func (self *BundleRef) RuntimeRepoURL() string

RuntimeRepoURL: get the runtime flatpakrepo url stored in the bundle (if any).

The function returns the following values:

type BundleRefOverrider

type BundleRefOverrider interface {
}

BundleRefOverrider contains methods that are overridable.

type Error

type Error C.gint

Error codes for library functions.

const (
	// ErrorAlreadyInstalled: app/runtime/remote is already installed.
	ErrorAlreadyInstalled Error = iota
	// ErrorNotInstalled: app/runtime is not installed.
	ErrorNotInstalled
	// ErrorOnlyPulled: app/runtime was only pulled into the local repository
	// but not installed.
	ErrorOnlyPulled
	// ErrorDifferentRemote: app/Runtime is already installed, but from a
	// different remote.
	ErrorDifferentRemote
	// ErrorAborted: transaction was aborted (returned TRUE in operation-error
	// signal).
	ErrorAborted
	// ErrorSkipped: app/Runtime install was skipped due to earlier errors.
	ErrorSkipped
	// ErrorNeedNewFlatpak: app/Runtime needs a more recent version of flatpak.
	ErrorNeedNewFlatpak
	// ErrorRemoteNotFound: specified remote was not found.
	ErrorRemoteNotFound
	// ErrorRuntimeNotFound: runtime needed for the app was not found.
	ErrorRuntimeNotFound
	// ErrorDowngrade: pulled commit is a downgrade, and a downgrade wasn't
	// specifically allowed. (Since: 1.0).
	ErrorDowngrade
	// ErrorInvalidRef: ref could not be parsed. (Since: 1.0.3).
	ErrorInvalidRef
	// ErrorInvalidData: invalid data. (Since: 1.0.3).
	ErrorInvalidData
	// ErrorUntrusted: missing GPG key or signature. (Since: 1.0.3).
	ErrorUntrusted
	// ErrorSetupFailed: sandbox setup failed. (Since: 1.0.3).
	ErrorSetupFailed
	// ErrorExportFailed: exporting data failed. (Since: 1.0.3).
	ErrorExportFailed
	// ErrorRemoteUsed: remote can't be uninstalled. (Since: 1.0.3).
	ErrorRemoteUsed
	// ErrorRuntimeUsed: runtime can't be uninstalled. (Since: 1.0.3).
	ErrorRuntimeUsed
	// ErrorInvalidName: application, runtime or remote name is invalid. (Since:
	// 1.0.3).
	ErrorInvalidName
	// ErrorOutOfSpace: more disk space needed. (Since: 1.2.0).
	ErrorOutOfSpace
	// ErrorWrongUser: operation is being attempted by the wrong user (such as
	// root operating on a user installation). (Since: 1.2.0).
	ErrorWrongUser
	// ErrorNotCached: cached data was requested, but it was not available.
	// (Since: 1.4.0).
	ErrorNotCached
	// ErrorRefNotFound: specified ref was not found. (Since: 1.4.0).
	ErrorRefNotFound
	// ErrorPermissionDenied: operation was not allowed by the administrative
	// policy. For example, an app is not allowed to be installed due to not
	// complying with the parental controls policy. (Since: 1.5.1).
	ErrorPermissionDenied
	// ErrorAuthenticationFailed: authentication operation failed, for example,
	// no correct password was supplied. (Since: 1.7.3).
	ErrorAuthenticationFailed
	// ErrorNotAuthorized: operation tried to access a ref, or information about
	// it that it was not authorized. For example, when succesfully
	// authenticating with a server but the user doesn't have permissions for a
	// private ref. (Since: 1.7.3).
	ErrorNotAuthorized
)

func (Error) String

func (e Error) String() string

String returns the name in string for Error.

type InstallFlags

type InstallFlags C.guint

InstallFlags flags to alter the behavior of flatpak_installation_install_full().

const (
	// InstallFlagsNone: default.
	InstallFlagsNone InstallFlags = 0b0
	// InstallFlagsNoStaticDeltas: don't use static deltas when pulling.
	InstallFlagsNoStaticDeltas InstallFlags = 0b1
	// InstallFlagsNoDeploy: don't install any new builds that might be fetched.
	InstallFlagsNoDeploy InstallFlags = 0b100
	// InstallFlagsNoPull: don't try to fetch new builds from the remote repo.
	InstallFlagsNoPull InstallFlags = 0b1000
	// InstallFlagsNoTriggers: don't call triggers after installing. If used,
	// the caller must later call flatpak_installation_run_triggers() to update
	// the exported files. (Since: 1.0.3).
	InstallFlagsNoTriggers InstallFlags = 0b10000
)

func (InstallFlags) Has

func (i InstallFlags) Has(other InstallFlags) bool

Has returns true if i contains other.

func (InstallFlags) String

func (i InstallFlags) String() string

String returns the names in string for InstallFlags.

type Installation

type Installation struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func NewInstallationForPath

func NewInstallationForPath(ctx context.Context, path gio.Filer, user bool) (*Installation, error)

NewInstallationForPath creates a new Installation for the installation at the given path.

The function takes the following parameters:

The function returns the following values:

func NewInstallationSystem

func NewInstallationSystem(ctx context.Context) (*Installation, error)

NewInstallationSystem creates a new Installation for the default system-wide installation.

The function takes the following parameters:

The function returns the following values:

func NewInstallationSystemWithID

func NewInstallationSystemWithID(ctx context.Context, id string) (*Installation, error)

NewInstallationSystemWithID creates a new Installation for the system-wide installation id.

The function takes the following parameters:

The function returns the following values:

func NewInstallationUser

func NewInstallationUser(ctx context.Context) (*Installation, error)

NewInstallationUser creates a new Installation for the per-user installation.

The function takes the following parameters:

The function returns the following values:

func (*Installation) AddRemote

func (self *Installation) AddRemote(ctx context.Context, remote *Remote, ifNeeded bool) error

AddRemote adds a new remote object to the set of remotes. This is similar to flatpak_installation_modify_remote() for non-existing remote names. However, if the named remote already exists then instead of modifying it it fails with FLATPAK_ERROR_ALREADY_INSTALLED, or if if_needed is true it silently succeeds without doing anything.

As an exception to the last, if the local config has a filter defined, but the new remote unsets the filter (for example, it comes from an unfiltered .flatpakref via flatpak_remote_new_from_file()) the the local remote filter gets reset. This is to allow the setup where there is a default setup of a filtered remote, yet you can still use the standard flatpakref file to get the full contents without getting two remotes.

The function takes the following parameters:

func (*Installation) CleanupLocalRefsSync

func (self *Installation) CleanupLocalRefsSync(ctx context.Context) error

CleanupLocalRefsSync: remove all OSTree refs from the local flatpak repository which are not in a deployed state. The next time the underlying OSTree repo is pruned, objects which were attached to that ref will be removed. This is useful if you pulled a flatpak refs using flatpak_installation_install_full() and specified FLATPAK_INSTALL_FLAGS_NO_DEPLOY but then decided not to deploy the refs later on and want to remove the local refs to prevent them from taking up disk space. Note that this will not remove the objects referred to by ref from the underlying OSTree repo, you should use flatpak_installation_prune_local_repo() to do that.

The function takes the following parameters:

func (*Installation) Config

func (self *Installation) Config(ctx context.Context, key string) (string, error)

Config: get a global configuration option for the installation, see flatpak_installation_set_config_sync() for supported keys.

The function takes the following parameters:

The function returns the following values:

func (*Installation) CreateMonitor

func (self *Installation) CreateMonitor(ctx context.Context) (gio.FileMonitorrer, error)

CreateMonitor gets monitor object for the installation. The returned file monitor will emit the Monitor::changed signal whenever an application or runtime was installed, uninstalled or updated.

The function takes the following parameters:

The function returns the following values:

func (*Installation) CurrentInstalledApp

func (self *Installation) CurrentInstalledApp(ctx context.Context, name string) (*InstalledRef, error)

CurrentInstalledApp: get the last build of reference name that was installed with flatpak_installation_install(), or NULL if the reference has never been installed locally.

The function takes the following parameters:

The function returns the following values:

func (*Installation) DefaultLanguages

func (self *Installation) DefaultLanguages() ([]string, error)

DefaultLanguages: get the default languages used by the installation to decide which subpaths to install of locale extensions. This list may also be used by frontends like GNOME Software to decide which language-specific apps to display. An empty array means that all languages should be installed.

The function returns the following values:

func (*Installation) DefaultLocales

func (self *Installation) DefaultLocales() ([]string, error)

DefaultLocales: like flatpak_installation_get_default_languages() but includes territory information (e.g. en_US rather than en) which may be included in the extra-languages configuration.

Strings returned by this function are in the format specified by setlocale() (man:setlocale): language[_territory][.codeset][modifier].

The function returns the following values:

func (*Installation) DisplayName

func (self *Installation) DisplayName() string

DisplayName returns the display name of the installation for self.

Note that this function may return NULL if the installation does not have a display name.

The function returns the following values:

func (*Installation) DropCaches

func (self *Installation) DropCaches(ctx context.Context) error

DropCaches drops all internal (in-memory) caches. For instance, this may be needed to pick up new or changed remotes configured outside this installation instance.

The function takes the following parameters:

func (*Installation) FetchRemoteMetadataSync

func (self *Installation) FetchRemoteMetadataSync(ctx context.Context, remoteName string, ref *Ref) (*glib.Bytes, error)

FetchRemoteMetadataSync obtains the metadata file from a commit.

NOTE: Since 0.11.4 this information is accessible in FlatpakRemoteRef, so this function is not very useful anymore.

The function takes the following parameters:

The function returns the following values:

func (*Installation) FetchRemoteRefSync

func (self *Installation) FetchRemoteRefSync(ctx context.Context, remoteName string, kind RefKind, name, arch, branch string) (*RemoteRef, error)

FetchRemoteRefSync gets the current remote branch of a ref in the remote.

The function takes the following parameters:

The function returns the following values:

func (*Installation) FetchRemoteRefSyncFull

func (self *Installation) FetchRemoteRefSyncFull(ctx context.Context, remoteName string, kind RefKind, name, arch, branch string, flags QueryFlags) (*RemoteRef, error)

FetchRemoteRefSyncFull gets the current remote branch of a ref in the remote.

The function takes the following parameters:

The function returns the following values:

func (*Installation) FetchRemoteSizeSync

func (self *Installation) FetchRemoteSizeSync(ctx context.Context, remoteName string, ref *Ref) (downloadSize uint64, installedSize uint64, goerr error)

FetchRemoteSizeSync gets information about the maximum amount of data that needs to be transferred to pull the ref from a remote repository, and about the amount of local disk space that is required to check out this commit.

Note that if there are locally available data that are in the ref, which is common for instance if you're doing an update then the real download size may be smaller than what is returned here.

NOTE: Since 0.11.4 this information is accessible in FlatpakRemoteRef, so this function is not very useful anymore.

The function takes the following parameters:

The function returns the following values:

func (*Installation) ID

func (self *Installation) ID() string

ID returns the ID of the installation for self.

The ID for the default system installation is "default". The ID for the user installation is "user".

The function returns the following values:

func (*Installation) Install

func (self *Installation) Install(ctx context.Context, remoteName string, kind RefKind, name, arch, branch string, progress ProgressCallback) (*InstalledRef, error)

Install: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_install() instead. It has a lot more interesting features.

Install a new application or runtime.

Note that this function was originally written to always return a InstalledRef. Since 0.9.13, passing FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak repository without deploying them, however this function will be unable to provide information on the installed ref, so FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond accordingly.

Deprecated: Use flatpak_transaction_add_install() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) InstallBundle

func (self *Installation) InstallBundle(ctx context.Context, file gio.Filer, progress ProgressCallback) (*InstalledRef, error)

InstallBundle: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_install_bundle() instead. It has a lot more interesting features.

Install an application or runtime from an flatpak bundle file. See flatpak-build-bundle(1) for how to create bundles.

Deprecated: Use flatpak_transaction_add_install_bundle() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) InstallFull

func (self *Installation) InstallFull(ctx context.Context, flags InstallFlags, remoteName string, kind RefKind, name, arch, branch string, subpaths []string, progress ProgressCallback) (*InstalledRef, error)

InstallFull: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_install() instead. It has a lot more interesting features.

Install a new application or runtime.

Note that this function was originally written to always return a InstalledRef. Since 0.9.13, passing FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak repository without deploying them, however this function will be unable to provide information on the installed ref, so FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond accordingly.

Deprecated: Use flatpak_transaction_add_install() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) InstallRefFile

func (self *Installation) InstallRefFile(ctx context.Context, refFileData *glib.Bytes) (*RemoteRef, error)

InstallRefFile: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_install_flatpakref() instead. It has a lot more interesting features.

Creates a remote based on the passed in .flatpakref file contents in ref_file_data and returns the RemoteRef that can be used to install it.

Note, the RemoteRef will not have the commit field set, or other details, to avoid unnecessary roundtrips. If you need that you have to resolve it explicitly with flatpak_installation_fetch_remote_ref_sync ().

Deprecated: Use flatpak_transaction_add_install_flatpakref() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) IsUser

func (self *Installation) IsUser() bool

IsUser returns whether the installation is for a user-specific location.

The function returns the following values:

func (*Installation) Launch

func (self *Installation) Launch(ctx context.Context, name, arch, branch, commit string) error

Launch an installed application.

You can use flatpak_installation_get_installed_ref() or flatpak_installation_get_current_installed_app() to find out what builds are available, in order to get a value for commit.

The function takes the following parameters:

func (*Installation) LoadAppOverrides

func (self *Installation) LoadAppOverrides(ctx context.Context, appId string) (string, error)

LoadAppOverrides loads the metadata overrides file for an application.

The function takes the following parameters:

The function returns the following values:

func (*Installation) MinFreeSpaceBytes

func (self *Installation) MinFreeSpaceBytes() (uint64, error)

MinFreeSpaceBytes returns the min-free-space config value from the OSTree repository of this installation.

Applications can use this value, together with information about the available disk space and the size of pending updates or installs, to estimate whether a pull operation will fail due to running out of disk space.

The function returns the following values:

func (*Installation) ModifyRemote

func (self *Installation) ModifyRemote(ctx context.Context, remote *Remote) error

ModifyRemote saves changes in the remote object.

The function takes the following parameters:

func (*Installation) NoInteraction

func (self *Installation) NoInteraction() bool

NoInteraction returns the value set with flatpak_installation_set_no_interaction().

The function returns the following values:

func (*Installation) Path

func (self *Installation) Path() *gio.File

Path returns the installation location for self.

The function returns the following values:

func (*Installation) Priority

func (self *Installation) Priority() int

Priority returns the numeric priority of the installation for self.

The function returns the following values:

func (*Installation) PruneLocalRepo

func (self *Installation) PruneLocalRepo(ctx context.Context) error

PruneLocalRepo: remove all orphaned OSTree objects from the underlying OSTree repo in self.

The function takes the following parameters:

func (*Installation) RemoteByName

func (self *Installation) RemoteByName(ctx context.Context, name string) (*Remote, error)

RemoteByName looks up a remote by name.

The function takes the following parameters:

The function returns the following values:

func (*Installation) RemoveLocalRefSync

func (self *Installation) RemoveLocalRefSync(ctx context.Context, remoteName, ref string) error

RemoveLocalRefSync: remove the OSTree ref given by remote_name:ref from the local flatpak repository. The next time the underlying OSTree repo is pruned, objects which were attached to that ref will be removed. This is useful if you pulled a flatpak ref using flatpak_installation_install_full() and specified FLATPAK_INSTALL_FLAGS_NO_DEPLOY but then decided not to deploy the ref later on and want to remove the local ref to prevent it from taking up disk space. Note that this will not remove the objects referred to by ref from the underlying OSTree repo, you should use flatpak_installation_prune_local_repo() to do that.

The function takes the following parameters:

func (*Installation) RemoveRemote

func (self *Installation) RemoveRemote(ctx context.Context, name string) error

RemoveRemote removes the remote with the given name from the installation.

The function takes the following parameters:

func (*Installation) RunTriggers

func (self *Installation) RunTriggers(ctx context.Context) error

RunTriggers: run the trigger commands to update the files exported by the apps in self. Should be used after one or more app install, upgrade or uninstall operations with the FLATPAK_INSTALL_FLAGS_NO_TRIGGERS, FLATPAK_UPDATE_FLAGS_NO_TRIGGERS or FLATPAK_UNINSTALL_FLAGS_NO_TRIGGERS flags set.

The function takes the following parameters:

func (*Installation) SetConfigSync

func (self *Installation) SetConfigSync(ctx context.Context, key, value string) error

SetConfigSync: set a global configuration option for the installation, currently the only supported keys are languages, which is a semicolon-separated list of language codes like "sv;en;pl", or "" to mean all languages, and extra-languages, which is a semicolon-separated list of locale identifiers like "en;en_DK;zh_HK.big5hkscs;uz_UZ.utf8cyrillic".

The function takes the following parameters:

func (*Installation) SetNoInteraction

func (self *Installation) SetNoInteraction(noInteraction bool)

SetNoInteraction: this method can be used to prevent interactive authorization dialogs to appear for operations on self. This is useful for background operations that are not directly triggered by a user action.

By default, interaction is allowed.

The function takes the following parameters:

func (*Installation) StorageType

func (self *Installation) StorageType() StorageType

StorageType returns the type of storage of the installation for self.

The function returns the following values:

func (*Installation) Uninstall

func (self *Installation) Uninstall(ctx context.Context, kind RefKind, name, arch, branch string, progress ProgressCallback) error

Uninstall: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_uninstall() instead. It has a lot more interesting features.

Uninstall an application or runtime.

Deprecated: Use flatpak_transaction_add_uninstall() instead.

The function takes the following parameters:

func (*Installation) UninstallFull

func (self *Installation) UninstallFull(ctx context.Context, flags UninstallFlags, kind RefKind, name, arch, branch string, progress ProgressCallback) error

UninstallFull: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_uninstall() instead. It has a lot more interesting features.

Uninstall an application or runtime.

Deprecated: Use flatpak_transaction_add_uninstall() instead.

The function takes the following parameters:

func (*Installation) Update

func (self *Installation) Update(ctx context.Context, flags UpdateFlags, kind RefKind, name, arch, branch string, progress ProgressCallback) (*InstalledRef, error)

Update: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_update() instead. It has a lot more interesting features.

Update an application or runtime.

If the specified package is not installed, then FLATPAK_ERROR_NOT_INSTALLED will be thrown.

If no updates could be found on the remote end and the package is already up to date, then FLATPAK_ERROR_ALREADY_INSTALLED will be thrown.

Deprecated: Use flatpak_transaction_add_update() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) UpdateFull

func (self *Installation) UpdateFull(ctx context.Context, flags UpdateFlags, kind RefKind, name, arch, branch string, subpaths []string, progress ProgressCallback) (*InstalledRef, error)

UpdateFull: this is an old deprecated function, you should use Transaction and flatpak_transaction_add_update() instead. It has a lot more interesting features.

Update an application or runtime.

If the specified package is not installed, then FLATPAK_ERROR_NOT_INSTALLED will be thrown.

If no updates could be found on the remote end and the package is already up to date, then FLATPAK_ERROR_ALREADY_INSTALLED will be thrown.

Deprecated: Use flatpak_transaction_add_update() instead.

The function takes the following parameters:

The function returns the following values:

func (*Installation) UpdateRemoteSync

func (self *Installation) UpdateRemoteSync(ctx context.Context, name string) error

UpdateRemoteSync updates the local configuration of a remote repository by fetching the related information from the summary file in the remote OSTree repository and committing the changes to the local installation.

The function takes the following parameters:

type InstallationOverrider

type InstallationOverrider interface {
}

InstallationOverrider contains methods that are overridable.

type InstalledRef

type InstalledRef struct {
	Ref
	// contains filtered or unexported fields
}

func (*InstalledRef) AppdataContentRating

func (self *InstalledRef) AppdataContentRating() map[string]string

AppdataContentRating returns the content rating field from the appdata. This is a potentially empty mapping of content rating attribute IDs to values, to be interpreted by the semantics of the content rating type (see flatpak_installed_ref_get_appdata_content_rating_type()).

The function returns the following values:

func (*InstalledRef) AppdataContentRatingType

func (self *InstalledRef) AppdataContentRatingType() string

AppdataContentRatingType returns the content rating type from the appdata. For example, oars-1.0 or oars-1.1.

The function returns the following values:

func (*InstalledRef) AppdataLicense

func (self *InstalledRef) AppdataLicense() string

AppdataLicense returns the license field from the appdata.

The function returns the following values:

func (*InstalledRef) AppdataName

func (self *InstalledRef) AppdataName() string

AppdataName returns the name field from the appdata.

The returned string is localized.

The function returns the following values:

func (*InstalledRef) AppdataSummary

func (self *InstalledRef) AppdataSummary() string

AppdataSummary returns the summary field from the appdata.

The returned string is localized.

The function returns the following values:

func (*InstalledRef) AppdataVersion

func (self *InstalledRef) AppdataVersion() string

AppdataVersion returns the default version field from the appdata.

The function returns the following values:

func (*InstalledRef) DeployDir

func (self *InstalledRef) DeployDir() string

DeployDir gets the deploy dir of the ref.

The function returns the following values:

func (*InstalledRef) Eol

func (self *InstalledRef) Eol() string

Eol returns the end-of-life reason string, or NULL if the ref is not end-of-lifed.

The function returns the following values:

func (*InstalledRef) EolRebase

func (self *InstalledRef) EolRebase() string

EolRebase returns the end-of-life rebased ref, or NULL if the ref is not end-of-lifed.

The function returns the following values:

func (*InstalledRef) InstalledSize

func (self *InstalledRef) InstalledSize() uint64

InstalledSize returns the installed size of the ref.

The function returns the following values:

func (*InstalledRef) IsCurrent

func (self *InstalledRef) IsCurrent() bool

IsCurrent returns whether the ref is current.

The function returns the following values:

func (*InstalledRef) LatestCommit

func (self *InstalledRef) LatestCommit() string

LatestCommit gets the latest commit of the ref.

The function returns the following values:

func (*InstalledRef) LoadAppdata

func (self *InstalledRef) LoadAppdata(ctx context.Context) (*glib.Bytes, error)

LoadAppdata loads the compressed xml appdata for this ref (if it exists).

The function takes the following parameters:

The function returns the following values:

func (*InstalledRef) LoadMetadata

func (self *InstalledRef) LoadMetadata(ctx context.Context) (*glib.Bytes, error)

LoadMetadata loads the metadata file for this ref.

The function takes the following parameters:

The function returns the following values:

func (*InstalledRef) Origin

func (self *InstalledRef) Origin() string

Origin gets the origin of the ref.

The function returns the following values:

func (*InstalledRef) Subpaths

func (self *InstalledRef) Subpaths() []string

Subpaths returns the subpaths that are installed, or NULL if all files installed.

The function returns the following values:

type InstalledRefOverrider

type InstalledRefOverrider interface {
}

InstalledRefOverrider contains methods that are overridable.

type Instance

type Instance struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func (*Instance) App

func (self *Instance) App() string

App gets the application ID of the application running in the instance.

Note that this may return NULL for sandboxes that don't have an application.

The function returns the following values:

func (*Instance) Arch

func (self *Instance) Arch() string

Arch gets the architecture of the application running in the instance.

The function returns the following values:

func (*Instance) Branch

func (self *Instance) Branch() string

Branch gets the branch of the application running in the instance.

The function returns the following values:

func (*Instance) ChildPid

func (self *Instance) ChildPid() int

ChildPid gets the PID of the application process in the sandbox.

See flatpak_instance_get_pid().

Note that this function may return 0 immediately after launching a sandbox, for a short amount of time.

The function returns the following values:

func (*Instance) Commit

func (self *Instance) Commit() string

Commit gets the commit of the application running in the instance.

The function returns the following values:

func (*Instance) ID

func (self *Instance) ID() string

ID gets the instance ID. The ID is used by Flatpak for bookkeeping purposes and has no further relevance.

The function returns the following values:

func (*Instance) Info

func (self *Instance) Info() *glib.KeyFile

Info gets a keyfile that holds information about the running sandbox.

This file is available as /.flatpak-info inside the sandbox as well.

The most important data in the keyfile is available with separate getters, but there may be more information in the keyfile.

The function returns the following values:

func (*Instance) IsRunning

func (self *Instance) IsRunning() bool

IsRunning finds out if the sandbox represented by self is still running.

The function returns the following values:

func (*Instance) Pid

func (self *Instance) Pid() int

Pid gets the PID of the outermost process in the sandbox. This is not the application process itself, but a bubblewrap 'babysitter' process.

See flatpak_instance_get_child_pid().

The function returns the following values:

func (*Instance) Runtime

func (self *Instance) Runtime() string

Runtime gets the ref of the runtime used in the instance.

The function returns the following values:

func (*Instance) RuntimeCommit

func (self *Instance) RuntimeCommit() string

RuntimeCommit gets the commit of the runtime used in the instance.

The function returns the following values:

type InstanceOverrider

type InstanceOverrider interface {
}

InstanceOverrider contains methods that are overridable.

type LaunchFlags

type LaunchFlags C.guint

LaunchFlags flags to alter the behavior of flatpak_installation_launch_full().

const (
	// LaunchFlagsNone: default.
	LaunchFlagsNone LaunchFlags = 0b0
	// LaunchFlagsDoNotReap: do not reap the child. Use this if you want to wait
	// for the child with g_child_watch_add(). (Since: 1.1).
	LaunchFlagsDoNotReap LaunchFlags = 0b1
)

func (LaunchFlags) Has

func (l LaunchFlags) Has(other LaunchFlags) bool

Has returns true if l contains other.

func (LaunchFlags) String

func (l LaunchFlags) String() string

String returns the names in string for LaunchFlags.

type PortalError

type PortalError C.gint

PortalError: error codes returned by portal calls.

const (
	// PortalErrorFailed: general portal failure.
	PortalErrorFailed PortalError = iota
	// PortalErrorInvalidArgument: argument was invalid.
	PortalErrorInvalidArgument
	// PortalErrorNotFound: object was not found.
	PortalErrorNotFound
	// PortalErrorExists: object already exists.
	PortalErrorExists
	// PortalErrorNotAllowed: call was not allowed.
	PortalErrorNotAllowed
	// PortalErrorCancelled: call was cancelled by the user.
	PortalErrorCancelled
	// PortalErrorWindowDestroyed: window was destroyed by the user.
	PortalErrorWindowDestroyed
)

func (PortalError) String

func (p PortalError) String() string

String returns the name in string for PortalError.

type ProgressCallback

type ProgressCallback func(status string, progress uint, estimating bool)

ProgressCallback progress callback is called repeatedly during long-running operations such as installations or updates, and can be used to update progress information in a user interface.

The callback occurs in the thread-default context of the caller.

type QueryFlags

type QueryFlags C.guint

QueryFlags flags to alter the behavior of e.g flatpak_installation_list_remote_refs_sync_full().

const (
	// QueryFlagsNone: default.
	QueryFlagsNone QueryFlags = 0b0
	// QueryFlagsOnlyCached: don't do any network i/o, but only return cached
	// data. This can return stale data, or a ATPAK_ERROR_NOT_CACHED error,
	// however it is a lot more efficient if you're doing many requests.
	QueryFlagsOnlyCached QueryFlags = 0b1
	// QueryFlagsOnlySideloaded: only list refs available from sideload repos;
	// see flatpak(1). (Since: 1.7).
	QueryFlagsOnlySideloaded QueryFlags = 0b10
	// QueryFlagsAllArches: include refs from all arches, not just the primary
	// ones. (Since: 1.11.2).
	QueryFlagsAllArches QueryFlags = 0b100
)

func (QueryFlags) Has

func (q QueryFlags) Has(other QueryFlags) bool

Has returns true if q contains other.

func (QueryFlags) String

func (q QueryFlags) String() string

String returns the names in string for QueryFlags.

type Ref

type Ref struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func RefParse

func RefParse(ref string) (*Ref, error)

RefParse tries to parse a full ref name and return a Ref (without a commit set) or fail if the ref is invalid somehow.

The function takes the following parameters:

The function returns the following values:

func (*Ref) Arch

func (self *Ref) Arch() string

Arch gets the arch or the ref.

The function returns the following values:

func (*Ref) Branch

func (self *Ref) Branch() string

Branch gets the branch of the ref.

The function returns the following values:

func (*Ref) CollectionID

func (self *Ref) CollectionID() string

CollectionID gets the collection ID of the ref.

The function returns the following values:

func (*Ref) Commit

func (self *Ref) Commit() string

Commit gets the commit of the ref.

The function returns the following values:

func (*Ref) FormatRefCached

func (self *Ref) FormatRefCached() string

FormatRefCached: like flatpak_ref_format_ref() but this returns the same string each time it's called rather than allocating a new one.

The function returns the following values:

func (*Ref) Kind

func (self *Ref) Kind() RefKind

Kind gets the kind of artifact that this ref refers to.

The function returns the following values:

func (*Ref) Name

func (self *Ref) Name() string

Name gets the name of the ref.

The function returns the following values:

type RefKind

type RefKind C.gint

RefKind: kind of artifact that a FlatpakRef refers to.

const (
	// RefKindApp: application.
	RefKindApp RefKind = iota
	// RefKindRuntime: runtime that applications can use.
	RefKindRuntime
)

func (RefKind) String

func (r RefKind) String() string

String returns the name in string for RefKind.

type RefOverrider

type RefOverrider interface {
}

RefOverrider contains methods that are overridable.

type RelatedRef

type RelatedRef struct {
	Ref
	// contains filtered or unexported fields
}

func (*RelatedRef) ShouldAutoprune

func (self *RelatedRef) ShouldAutoprune() bool

ShouldAutoprune returns whether to delete when pruning unused refs.

The function returns the following values:

func (*RelatedRef) ShouldDelete

func (self *RelatedRef) ShouldDelete() bool

ShouldDelete returns whether to auto-delete the ref with the main ref.

The function returns the following values:

func (*RelatedRef) ShouldDownload

func (self *RelatedRef) ShouldDownload() bool

ShouldDownload returns whether to auto-download the ref with the main ref.

The function returns the following values:

func (*RelatedRef) Subpaths

func (self *RelatedRef) Subpaths() []string

Subpaths returns the subpaths that should be installed/updated for the ref. This returns NULL if all files should be installed.

The function returns the following values:

type RelatedRefOverrider

type RelatedRefOverrider interface {
}

RelatedRefOverrider contains methods that are overridable.

type Remote

type Remote struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(name string) *Remote

NewRemote returns a new remote object which can be used to configure a new remote.

Note: This is a local configuration object, you must commit changes using flatpak_installation_modify_remote() or flatpak_installation_add_remote() for the changes to take effect.

The function takes the following parameters:

The function returns the following values:

func NewRemoteFromFile

func NewRemoteFromFile(name string, data *glib.Bytes) (*Remote, error)

NewRemoteFromFile returns a new pre-filled remote object which can be used to configure a new remote. The fields in the remote are filled in according to the values in the passed in flatpakrepo file.

Note: This is a local configuration object, you must commit changes using flatpak_installation_modify_remote() or flatpak_installation_add_remote() for the changes to take effect.

The function takes the following parameters:

The function returns the following values:

func (*Remote) AppstreamDir

func (self *Remote) AppstreamDir(arch string) *gio.File

AppstreamDir returns the directory where this remote will store locally cached appstream information for the specified arch.

The function takes the following parameters:

The function returns the following values:

func (*Remote) AppstreamTimestamp

func (self *Remote) AppstreamTimestamp(arch string) *gio.File

AppstreamTimestamp returns the timestamp file that will be updated whenever the appstream information has been updated (or tried to update) for the specified arch.

The function takes the following parameters:

The function returns the following values:

func (*Remote) CollectionID

func (self *Remote) CollectionID() string

CollectionID returns the repository collection ID of this remote, if set.

The function returns the following values:

func (*Remote) Comment

func (self *Remote) Comment() string

Comment returns the comment of the remote.

The function returns the following values:

func (*Remote) DefaultBranch

func (self *Remote) DefaultBranch() string

DefaultBranch returns the default branch configured for the remote.

The function returns the following values:

func (*Remote) Description

func (self *Remote) Description() string

Description returns the description of the remote.

The function returns the following values:

func (*Remote) Disabled

func (self *Remote) Disabled() bool

Disabled returns whether this remote is disabled.

The function returns the following values:

func (*Remote) Filter

func (self *Remote) Filter() string

Filter returns the filter file of the remote.

The function returns the following values:

func (*Remote) GpgVerify

func (self *Remote) GpgVerify() bool

GpgVerify returns whether GPG verification is enabled for the remote.

The function returns the following values:

func (*Remote) Homepage

func (self *Remote) Homepage() string

Homepage returns the homepage url of the remote.

The function returns the following values:

func (*Remote) Icon

func (self *Remote) Icon() string

Icon returns the icon url of the remote.

The function returns the following values:

func (*Remote) Name

func (self *Remote) Name() string

Name returns the name of the remote repository.

The function returns the following values:

func (*Remote) Nodeps

func (self *Remote) Nodeps() bool

Nodeps returns whether this remote should be used to find dependencies.

The function returns the following values:

func (*Remote) Noenumerate

func (self *Remote) Noenumerate() bool

Noenumerate returns whether this remote should be used to list applications.

The function returns the following values:

func (*Remote) Prio

func (self *Remote) Prio() int

Prio returns the priority for the remote.

The function returns the following values:

func (*Remote) RemoteType

func (self *Remote) RemoteType() RemoteType

RemoteType: get the value of Remote:type.

The function returns the following values:

func (*Remote) SetCollectionID

func (self *Remote) SetCollectionID(collectionId string)

SetCollectionID sets the repository collection ID of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetComment

func (self *Remote) SetComment(comment string)

SetComment sets the comment of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetDefaultBranch

func (self *Remote) SetDefaultBranch(defaultBranch string)

SetDefaultBranch sets the default branch configured for this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetDescription

func (self *Remote) SetDescription(description string)

SetDescription sets the description of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetDisabled

func (self *Remote) SetDisabled(disabled bool)

SetDisabled sets the disabled config of this remote. See flatpak_remote_get_disabled().

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetFilter

func (self *Remote) SetFilter(filterPath string)

SetFilter sets a filter for this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetGpgKey

func (self *Remote) SetGpgKey(gpgKey *glib.Bytes)

SetGpgKey sets the trusted gpg key for this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetGpgVerify

func (self *Remote) SetGpgVerify(gpgVerify bool)

SetGpgVerify sets the gpg_verify config of this remote. See flatpak_remote_get_gpg_verify().

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetHomepage

func (self *Remote) SetHomepage(homepage string)

SetHomepage sets the homepage of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetIcon

func (self *Remote) SetIcon(icon string)

SetIcon sets the homepage of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetNodeps

func (self *Remote) SetNodeps(nodeps bool)

SetNodeps sets the nodeps config of this remote. See flatpak_remote_get_nodeps().

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetNoenumerate

func (self *Remote) SetNoenumerate(noenumerate bool)

SetNoenumerate sets the noenumeration config of this remote. See flatpak_remote_get_noenumerate().

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetPrio

func (self *Remote) SetPrio(prio int)

SetPrio sets the prio config of this remote. See flatpak_remote_get_prio().

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetTitle

func (self *Remote) SetTitle(title string)

SetTitle sets the repository title of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) SetURL

func (self *Remote) SetURL(url string)

SetURL sets the repository URL of this remote.

Note: This is a local modification of this object, you must commit changes using flatpak_installation_modify_remote() for the changes to take effect.

The function takes the following parameters:

func (*Remote) Title

func (self *Remote) Title() string

Title returns the title of the remote.

The function returns the following values:

func (*Remote) URL

func (self *Remote) URL() string

URL returns the repository URL of this remote.

The function returns the following values:

type RemoteOverrider

type RemoteOverrider interface {
}

RemoteOverrider contains methods that are overridable.

type RemoteRef

type RemoteRef struct {
	Ref
	// contains filtered or unexported fields
}

func (*RemoteRef) DownloadSize

func (self *RemoteRef) DownloadSize() uint64

DownloadSize returns the download size of the ref.

The function returns the following values:

func (*RemoteRef) Eol

func (self *RemoteRef) Eol() string

Eol returns the end-of-life reason string, or NULL if the ref is not end-of-lifed.

The function returns the following values:

func (*RemoteRef) EolRebase

func (self *RemoteRef) EolRebase() string

EolRebase returns the end-of-life rebased ref, or NULL if the ref is not end-of-lifed.

The function returns the following values:

func (*RemoteRef) InstalledSize

func (self *RemoteRef) InstalledSize() uint64

InstalledSize returns the installed size of the ref.

The function returns the following values:

func (*RemoteRef) Metadata

func (self *RemoteRef) Metadata() *glib.Bytes

Metadata returns the app metadata from the metadata cache of the ref.

The function returns the following values:

func (*RemoteRef) RemoteName

func (self *RemoteRef) RemoteName() string

RemoteName gets the remote name of the ref.

The function returns the following values:

type RemoteRefOverrider

type RemoteRefOverrider interface {
}

RemoteRefOverrider contains methods that are overridable.

type RemoteType

type RemoteType C.gint

RemoteType: different types of FlatpakRemote.

const (
	// RemoteTypeStatic: statically configured remote.
	RemoteTypeStatic RemoteType = iota
	// RemoteTypeUsb: dynamically detected local pathname remote.
	RemoteTypeUsb
	// RemoteTypeLan: dynamically detected network remote.
	RemoteTypeLan
)

func (RemoteType) String

func (r RemoteType) String() string

String returns the name in string for RemoteType.

type StorageType

type StorageType C.gint

StorageType: information about the storage of an installation.

const (
	// StorageTypeDefault: default.
	StorageTypeDefault StorageType = iota
	// StorageTypeHardDisk: installation is on a hard disk.
	StorageTypeHardDisk
	// StorageTypeSdcard: installation is on a SD card.
	StorageTypeSdcard
	// StorageTypeMmc: installation is on an MMC.
	StorageTypeMmc
	// StorageTypeNetwork: installation is on the network.
	StorageTypeNetwork
)

func (StorageType) String

func (s StorageType) String() string

String returns the name in string for StorageType.

type Transaction

type Transaction struct {
	*externglib.Object

	gio.Initable
	// contains filtered or unexported fields
}

func NewTransactionForInstallation

func NewTransactionForInstallation(ctx context.Context, installation *Installation) (*Transaction, error)

NewTransactionForInstallation creates a new Transaction object that can be used to do installation and updates of multiple refs, as well as their dependencies, in a single operation. Set the options you want on the transaction and add the refs you want to install/update, then start the transaction with flatpak_transaction_run ().

The function takes the following parameters:

The function returns the following values:

func (*Transaction) AbortWebflow

func (self *Transaction) AbortWebflow(id uint)

AbortWebflow: cancel an ongoing webflow authentication request. This can be call in the time between Transaction::webflow-start returned TRUE, and Transaction::webflow-done is emitted. It will cancel the ongoing authentication operation.

This is useful for example if you're showing an authenticaion window with a browser, but the user closed it before it was finished.

The function takes the following parameters:

func (*Transaction) AddDefaultDependencySources

func (self *Transaction) AddDefaultDependencySources()

AddDefaultDependencySources: similar to flatpak_transaction_add_dependency_source(), but adds all the default installations, which means all the defined system-wide (but not per-user) installations.

func (*Transaction) AddDependencySource

func (self *Transaction) AddDependencySource(installation *Installation)

AddDependencySource adds an extra installation as a source for application dependencies. This means that applications can be installed in this transaction relying on runtimes from this additional installation (whereas it would normally install required runtimes that are not installed in the installation the transaction works on).

Also see flatpak_transaction_add_default_dependency_sources().

The function takes the following parameters:

func (*Transaction) AddInstall

func (self *Transaction) AddInstall(remote, ref string, subpaths []string) error

AddInstall adds installing the given ref to this transaction.

The remote can either be a configured remote of the installation, or a file:// uri pointing at a local repository to install from, in which case an origin remote is created.

The function takes the following parameters:

func (*Transaction) AddInstallBundle

func (self *Transaction) AddInstallBundle(file gio.Filer, gpgData *glib.Bytes) error

AddInstallBundle adds installing the given bundle to this transaction.

The function takes the following parameters:

func (*Transaction) AddInstallFlatpakref

func (self *Transaction) AddInstallFlatpakref(flatpakrefData *glib.Bytes) error

AddInstallFlatpakref adds installing the given flatpakref to this transaction.

The function takes the following parameters:

func (*Transaction) AddSideloadRepo

func (self *Transaction) AddSideloadRepo(path string)

AddSideloadRepo adds an extra local ostree repo as source for installation. This is equivalent to using the sideload-repos directories (see flatpak(1)), but can be done dynamically. Any path added here is used in addition to ones in those directories.

The function takes the following parameters:

func (*Transaction) AddUninstall

func (self *Transaction) AddUninstall(ref string) error

AddUninstall adds uninstalling the given ref to this transaction.

The function takes the following parameters:

func (*Transaction) AddUpdate

func (self *Transaction) AddUpdate(ref string, subpaths []string, commit string) error

AddUpdate adds updating the given ref to this transaction.

The function takes the following parameters:

func (*Transaction) CompleteBasicAuth

func (self *Transaction) CompleteBasicAuth(id uint, user, password string, options *glib.Variant)

CompleteBasicAuth finishes (or aborts) an ongoing basic auth request.

The function takes the following parameters:

func (*Transaction) ConnectAddNewRemote

func (self *Transaction) ConnectAddNewRemote(f func(reason TransactionRemoteReason, fromId, suggestedRemoteName, url string) (ok bool)) externglib.SignalHandle

ConnectAddNewRemote signal gets emitted if, as part of the transaction, it is required or recommended that a new remote is added, for the reason described in reason.

func (*Transaction) ConnectBasicAuthStart

func (self *Transaction) ConnectBasicAuthStart(f func(remote, realm string, options *glib.Variant, id int) (ok bool)) externglib.SignalHandle

ConnectBasicAuthStart signal gets emitted when a basic user/password authentication is needed during the operation. If the caller handles this it should ask the user for the user and password and return TRUE. Once the information is gathered call flatpak_transaction_complete_basic_auth() with it.

If the client does not support basic auth then return FALSE from this signal (or don't implement it). This will abort the authentication and likely result in the transaction failing (unless the authentication was somehow optional).

func (*Transaction) ConnectEndOfLifed

func (self *Transaction) ConnectEndOfLifed(f func(ref, reason, rebase string)) externglib.SignalHandle

ConnectEndOfLifed signal gets emitted when a ref is found to be marked as end-of-life during the execution of the transaction.

func (*Transaction) ConnectInstallAuthenticator

func (self *Transaction) ConnectInstallAuthenticator(f func(remote, authenticatorRef string)) externglib.SignalHandle

ConnectInstallAuthenticator signal gets emitted if, as part of resolving the transaction, we need to use an authenticator, but the authentication is not installed, but is available to be installed from the ref.

The application can handle this signal, and if so create another transaction to install the authenticator.

The default handler does nothing, and if the authenticator is not installed when the signal handler fails the transaction will error out.

func (*Transaction) ConnectNewOperation

func (self *Transaction) ConnectNewOperation(f func(operation *TransactionOperation, progress *TransactionProgress)) externglib.SignalHandle

ConnectNewOperation signal gets emitted during the execution of the transaction when a new operation is beginning.

func (*Transaction) ConnectOperationDone

func (self *Transaction) ConnectOperationDone(f func(operation *TransactionOperation, commit string, result TransactionResult)) externglib.SignalHandle

ConnectOperationDone signal gets emitted during the execution of the transaction when an operation is finished.

func (*Transaction) ConnectOperationError

func (self *Transaction) ConnectOperationError(f func(operation *TransactionOperation, err error, details TransactionErrorDetails) (ok bool)) externglib.SignalHandle

ConnectOperationError signal gets emitted when an error occurs during the execution of the transaction.

func (*Transaction) ConnectReady

func (self *Transaction) ConnectReady(f func() (ok bool)) externglib.SignalHandle

ConnectReady signal is emitted when all the refs involved in the operation have been resolved to commits, and the required authentication for all ops is gotten. At this point flatpak_transaction_get_operations() will return all the operations that will be executed as part of the transaction.

func (*Transaction) ConnectReadyPreAuth

func (self *Transaction) ConnectReadyPreAuth(f func() (ok bool)) externglib.SignalHandle

ConnectReadyPreAuth signal is emitted when all the refs involved in the transaction have been resolved to commits, but we might not necessarily have asked for authenticaion for all their required operations. This is very similar to the ::ready signal, and you can chose which one (or both) to use depending on how you want to handle authentication in your user interface.

At this point flatpak_transaction_get_operations() will return all the operations that will be executed as part of the transaction. You can call flatpak_transaction_operation_get_requires_authentication() to see which will require authentication.

func (*Transaction) ConnectWebflowDone

func (self *Transaction) ConnectWebflowDone(f func(options *glib.Variant, id int)) externglib.SignalHandle

ConnectWebflowDone signal gets emitted when the authentication finished the webflow, independent of the reason and results. If you for were showing a web-browser window it can now be closed.

func (*Transaction) ConnectWebflowStart

func (self *Transaction) ConnectWebflowStart(f func(remote, url string, options *glib.Variant, id int) (ok bool)) externglib.SignalHandle

ConnectWebflowStart signal gets emitted when some kind of user authentication is needed during the operation. If the caller handles this it should show the url in a webbrowser and return TRUE. This will eventually cause the webbrowser to finish the authentication operation and operation will continue, as signaled by the webflow-done being emitted.

If the client does not support webflow then return FALSE from this signal (or don't implement it). This will abort the authentication and likely result in the transaction failing (unless the authentication was somehow optional).

During the time between webflow-start and webflow-done the client can call flatpak_transaction_abort_webflow() to manually abort the authentication. This is useful if the user aborted the authentication operation some way, like e.g. closing the browser window.

func (*Transaction) CurrentOperation

func (self *Transaction) CurrentOperation() *TransactionOperation

CurrentOperation gets the current operation.

The function returns the following values:

func (*Transaction) IncludeUnusedUninstallOps

func (self *Transaction) IncludeUnusedUninstallOps() bool

IncludeUnusedUninstallOps gets the value set by flatpak_transaction_set_include_unused_uninstall_ops().

The function returns the following values:

func (*Transaction) Installation

func (self *Transaction) Installation() *Installation

Installation gets the installation this transaction was created for.

The function returns the following values:

func (*Transaction) IsEmpty

func (self *Transaction) IsEmpty() bool

IsEmpty returns whether the transaction contains any non-skipped operations.

The function returns the following values:

func (*Transaction) NoDeploy

func (self *Transaction) NoDeploy() bool

NoDeploy gets whether the transaction is only downloading updates, and not deploying them.

The function returns the following values:

func (*Transaction) NoPull

func (self *Transaction) NoPull() bool

NoPull gets whether the transaction should operate only on locally available data.

The function returns the following values:

func (*Transaction) Operations

func (self *Transaction) Operations() []*TransactionOperation

Operations gets the list of operations. Skipped operations are not included. The order of the list is the order in which the operations are executed.

The function returns the following values:

func (*Transaction) ParentWindow

func (self *Transaction) ParentWindow() string

ParentWindow gets the parent window set for this transaction, or NULL if unset. See flatpak_transaction_get_parent_window().

The function returns the following values:

func (*Transaction) Run

func (transaction *Transaction) Run(ctx context.Context) error

Run executes the transaction.

During the course of the execution, various signals will get emitted. The FlatpakTransaction::choose-remote-for-ref and Transaction::add-new-remote signals may get emitted while resolving operations. Transaction::ready is emitted when the transaction has been fully resolved, and Transaction::new-operation and Transaction::operation-done are emitted while the operations are carried out. If an error occurs at any point during the execution, Transaction::operation-error is emitted.

Note that this call blocks until the transaction is done.

The function takes the following parameters:

func (*Transaction) SetDefaultArch

func (self *Transaction) SetDefaultArch(arch string)

SetDefaultArch sets the architecture to default to where it is unspecified.

The function takes the following parameters:

func (*Transaction) SetDisableAutoPIN

func (self *Transaction) SetDisableAutoPIN(disablePin bool)

SetDisableAutoPIN: normally the transaction pins any explicit installations so they will not be automatically removed. But this can be disabled if you don't want this behaviour.

The function takes the following parameters:

func (*Transaction) SetDisableDependencies

func (self *Transaction) SetDisableDependencies(disableDependencies bool)

SetDisableDependencies sets whether the transaction should ignore runtime dependencies when resolving operations for applications.

The function takes the following parameters:

func (*Transaction) SetDisablePrune

func (self *Transaction) SetDisablePrune(disablePrune bool)

SetDisablePrune sets whether the transaction should avoid pruning the local OSTree repository after updating.

The function takes the following parameters:

func (*Transaction) SetDisableRelated

func (self *Transaction) SetDisableRelated(disableRelated bool)

SetDisableRelated sets whether the transaction should avoid adding related refs when resolving operations. Related refs are extensions that are suggested by apps, such as locales.

The function takes the following parameters:

func (*Transaction) SetDisableStaticDeltas

func (self *Transaction) SetDisableStaticDeltas(disableStaticDeltas bool)

SetDisableStaticDeltas sets whether the transaction should avoid using static deltas when pulling.

The function takes the following parameters:

func (*Transaction) SetForceUninstall

func (self *Transaction) SetForceUninstall(forceUninstall bool)

SetForceUninstall sets whether the transaction should uninstall files even if they're used by a running application.

The function takes the following parameters:

func (*Transaction) SetIncludeUnusedUninstallOps

func (self *Transaction) SetIncludeUnusedUninstallOps(includeUnusedUninstallOps bool)

SetIncludeUnusedUninstallOps: when this is set to TRUE, Flatpak will add uninstall operations to the transaction for each runtime it considers unused. This is used by the "update" CLI command to garbage collect runtimes and free disk space.

No guarantees are made about the exact hueristic used; e.g. only end-of-life unused runtimes may be uninstalled with this set. To see the full list of unused runtimes in an installation, use flatpak_installation_list_unused_refs().

The function takes the following parameters:

func (*Transaction) SetNoDeploy

func (self *Transaction) SetNoDeploy(noDeploy bool)

SetNoDeploy sets whether the transaction should download updates, but not deploy them.

The function takes the following parameters:

func (*Transaction) SetNoInteraction

func (self *Transaction) SetNoInteraction(noInteraction bool)

SetNoInteraction: this method can be used to prevent interactive authorization dialogs to appear for operations on self. This is useful for background operations that are not directly triggered by a user action.

By default, the setting from the parent Installation is used.

The function takes the following parameters:

func (*Transaction) SetNoPull

func (self *Transaction) SetNoPull(noPull bool)

SetNoPull sets whether the transaction should operate only on locally available data.

The function takes the following parameters:

func (*Transaction) SetParentWindow

func (self *Transaction) SetParentWindow(parentWindow string)

SetParentWindow sets the parent window (if any) to use for any UI show by this transaction. This is used by authenticators if they need to interact with the user during authentication.

The format of this string depends on the display system in use, and is the same as used by xdg-desktop-portal.

On X11 it should be of the form x11:$xid where $xid is the hex version of the xwindows id.

On wayland is should be wayland:$handle where handle is gotten by using the export call of the xdg-foreign-unstable wayland extension.

The function takes the following parameters:

func (*Transaction) SetReinstall

func (self *Transaction) SetReinstall(reinstall bool)

SetReinstall sets whether the transaction should uninstall first if a ref is already installed.

The function takes the following parameters:

type TransactionErrorDetails

type TransactionErrorDetails C.guint

TransactionErrorDetails details for Transaction::operation-error.

const (
	// TransactionErrorDetailsNonFatal: operation failure was not fatal.
	TransactionErrorDetailsNonFatal TransactionErrorDetails = 0b1
)

func (TransactionErrorDetails) Has

Has returns true if t contains other.

func (TransactionErrorDetails) String

func (t TransactionErrorDetails) String() string

String returns the names in string for TransactionErrorDetails.

type TransactionOperation

type TransactionOperation struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func (*TransactionOperation) BundlePath

func (self *TransactionOperation) BundlePath() *gio.File

BundlePath gets the path to the bundle.

The function returns the following values:

func (*TransactionOperation) Commit

func (self *TransactionOperation) Commit() string

Commit gets the commit ID for the operation.

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

func (*TransactionOperation) DownloadSize

func (self *TransactionOperation) DownloadSize() uint64

DownloadSize gets the maximum download size for the operation.

Note that this does not include the size of dependencies, and the actual download may be smaller, if some of the data is already available locally.

For uninstall operations, this returns 0.

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

func (*TransactionOperation) InstalledSize

func (self *TransactionOperation) InstalledSize() uint64

InstalledSize gets the installed size for the operation.

Note that even for a new install, the extra space required on disk may be smaller than this number, if some of the data is already available locally.

For uninstall operations, this returns 0.

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

func (*TransactionOperation) IsSkipped

func (self *TransactionOperation) IsSkipped() bool

IsSkipped gets whether this operation will be skipped when the transaction is run. Operations are skipped in some transaction situations, for example when an app has reached end of life and needs a rebase, or when it would have been updated but no update is available. By default, skipped operations are not returned by flatpak_transaction_get_operations() — but they can be accessed by traversing the operation graph using flatpak_transaction_operation_get_related_to_ops().

The function returns the following values:

func (*TransactionOperation) Metadata

func (self *TransactionOperation) Metadata() *glib.KeyFile

Metadata gets the metadata that will be applicable when the operation is done.

This can be compared to the current metadata returned by flatpak_transaction_operation_get_old_metadata() to find new required permissions and similar changes.

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

func (*TransactionOperation) OldMetadata

func (self *TransactionOperation) OldMetadata() *glib.KeyFile

OldMetadata gets the metadata current metadata for the ref that self works on. Also see flatpak_transaction_operation_get_metadata().

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

func (*TransactionOperation) OperationType

func (self *TransactionOperation) OperationType() TransactionOperationType

OperationType gets the type of the operation.

The function returns the following values:

func (*TransactionOperation) Remote

func (self *TransactionOperation) Remote() string

Remote gets the remote that the operation applies to.

The function returns the following values:

func (*TransactionOperation) RequiresAuthentication

func (self *TransactionOperation) RequiresAuthentication() bool

RequiresAuthentication gets whether the given operation will require authentication to acquire needed tokens. See also the documentation for Transaction::ready-pre-auth.

The function returns the following values:

func (*TransactionOperation) Subpaths

func (self *TransactionOperation) Subpaths() []string

Subpaths gets the set of subpaths that will be pulled from this ref.

Some refs are only partially installed, such as translations. These are subset by the toplevel directory (typically by translation name). The subset to install can be specified at install time, but is otherwise decided based on configurations and things like the current locale and how the app was previously installed.

If there is no subsetting active, this will always return NULL (even though some other APIs also take an empty string to mean no subsetting).

This information is available when the transaction is resolved, i.e. when Transaction::ready is emitted.

The function returns the following values:

type TransactionOperationOverrider

type TransactionOperationOverrider interface {
}

TransactionOperationOverrider contains methods that are overridable.

type TransactionOperationType

type TransactionOperationType C.gint

TransactionOperationType: type of a TransactionOperation.

const (
	// TransactionOperationInstall: install a ref from a remote.
	TransactionOperationInstall TransactionOperationType = iota
	// TransactionOperationUpdate: update an installed ref.
	TransactionOperationUpdate
	// TransactionOperationInstallBundle: install a bundle from a file.
	TransactionOperationInstallBundle
	// TransactionOperationUninstall: uninstall a ref.
	TransactionOperationUninstall
	// TransactionOperationLastType: (currently) last operation type.
	TransactionOperationLastType
)

func (TransactionOperationType) String

func (t TransactionOperationType) String() string

String returns the name in string for TransactionOperationType.

type TransactionOverrider

type TransactionOverrider interface {
	// The function takes the following parameters:
	//
	//    - reason
	//    - fromId
	//    - remoteName
	//    - url
	//
	// The function returns the following values:
	//
	AddNewRemote(reason TransactionRemoteReason, fromId, remoteName, url string) bool
	// The function takes the following parameters:
	//
	//    - remote
	//    - realm
	//    - options
	//    - id
	//
	// The function returns the following values:
	//
	BasicAuthStart(remote, realm string, options *glib.Variant, id uint) bool
	// The function takes the following parameters:
	//
	//    - ref
	//    - reason
	//    - rebase
	//
	EndOfLifed(ref, reason, rebase string)
	// The function takes the following parameters:
	//
	//    - remote
	//    - authenticatorRef
	//
	InstallAuthenticator(remote, authenticatorRef string)
	// The function takes the following parameters:
	//
	//    - operation
	//    - progress
	//
	NewOperation(operation *TransactionOperation, progress *TransactionProgress)
	// The function takes the following parameters:
	//
	//    - operation
	//    - commit
	//    - details
	//
	OperationDone(operation *TransactionOperation, commit string, details TransactionResult)
	// The function takes the following parameters:
	//
	//    - operation
	//    - err
	//    - detail
	//
	// The function returns the following values:
	//
	OperationError(operation *TransactionOperation, err error, detail TransactionErrorDetails) bool
	// The function returns the following values:
	//
	Ready() bool
	// The function returns the following values:
	//
	ReadyPreAuth() bool
	// Run executes the transaction.
	//
	// During the course of the execution, various signals will get emitted. The
	// FlatpakTransaction::choose-remote-for-ref and Transaction::add-new-remote
	// signals may get emitted while resolving operations. Transaction::ready is
	// emitted when the transaction has been fully resolved, and
	// Transaction::new-operation and Transaction::operation-done are emitted
	// while the operations are carried out. If an error occurs at any point
	// during the execution, Transaction::operation-error is emitted.
	//
	// Note that this call blocks until the transaction is done.
	//
	// The function takes the following parameters:
	//
	//    - ctx (optional): #GCancellable.
	//
	Run(ctx context.Context) error
	// The function takes the following parameters:
	//
	//    - options
	//    - id
	//
	WebflowDone(options *glib.Variant, id uint)
	// The function takes the following parameters:
	//
	//    - remote
	//    - url
	//    - options
	//    - id
	//
	// The function returns the following values:
	//
	WebflowStart(remote, url string, options *glib.Variant, id uint) bool
}

TransactionOverrider contains methods that are overridable.

type TransactionProgress

type TransactionProgress struct {
	*externglib.Object
	// contains filtered or unexported fields
}

func (*TransactionProgress) BytesTransferred

func (self *TransactionProgress) BytesTransferred() uint64

BytesTransferred gets the number of bytes that have been transferred.

The function returns the following values:

func (*TransactionProgress) ConnectChanged

func (self *TransactionProgress) ConnectChanged(f func()) externglib.SignalHandle

ConnectChanged is emitted when some detail of the progress object changes, you can call the various methods to get the current status.

func (*TransactionProgress) IsEstimating

func (self *TransactionProgress) IsEstimating() bool

IsEstimating gets whether the progress is currently estimating.

The function returns the following values:

func (*TransactionProgress) Progress

func (self *TransactionProgress) Progress() int

Progress gets the current progress.

The function returns the following values:

func (*TransactionProgress) SetUpdateFrequency

func (self *TransactionProgress) SetUpdateFrequency(updateInterval uint)

SetUpdateFrequency sets how often progress should be updated.

The function takes the following parameters:

func (*TransactionProgress) StartTime

func (self *TransactionProgress) StartTime() uint64

StartTime gets the time at which this operation has started, as monotonic time.

The function returns the following values:

func (*TransactionProgress) Status

func (self *TransactionProgress) Status() string

Status gets the current status string.

The function returns the following values:

type TransactionProgressOverrider

type TransactionProgressOverrider interface {
}

TransactionProgressOverrider contains methods that are overridable.

type TransactionRemoteReason

type TransactionRemoteReason C.gint

TransactionRemoteReason: reason for Transaction::add-new-remote.

const (
	// TransactionRemoteGenericRepo: remote specified in the flatpakref has
	// other apps too.
	TransactionRemoteGenericRepo TransactionRemoteReason = iota
	// TransactionRemoteRuntimeDeps: remote has runtimes needed for the app.
	TransactionRemoteRuntimeDeps
)

func (TransactionRemoteReason) String

func (t TransactionRemoteReason) String() string

String returns the name in string for TransactionRemoteReason.

type TransactionResult

type TransactionResult C.guint

TransactionResult details for Transaction::operation-done.

const (
	// TransactionResultNoChange: update caused no changes.
	TransactionResultNoChange TransactionResult = 0b1
)

func (TransactionResult) Has

Has returns true if t contains other.

func (TransactionResult) String

func (t TransactionResult) String() string

String returns the names in string for TransactionResult.

type UninstallFlags

type UninstallFlags C.guint

UninstallFlags flags to alter the behavior of flatpak_installation_uninstall_full().

const (
	// UninstallFlagsNone: default.
	UninstallFlagsNone UninstallFlags = 0b0
	// UninstallFlagsNoPrune: don't prune the local OSTree repository after
	// uninstalling.
	UninstallFlagsNoPrune UninstallFlags = 0b1
	// UninstallFlagsNoTriggers: don't call triggers after uninstalling. If
	// used, the caller must later call flatpak_installation_run_triggers() to
	// update the exported file. (Since: 1.0.3).
	UninstallFlagsNoTriggers UninstallFlags = 0b10
)

func (UninstallFlags) Has

func (u UninstallFlags) Has(other UninstallFlags) bool

Has returns true if u contains other.

func (UninstallFlags) String

func (u UninstallFlags) String() string

String returns the names in string for UninstallFlags.

type UpdateFlags

type UpdateFlags C.guint

UpdateFlags flags to alter the behavior of flatpak_installation_update().

const (
	// UpdateFlagsNone: fetch remote builds and install the latest one
	// (default).
	UpdateFlagsNone UpdateFlags = 0b0
	// UpdateFlagsNoDeploy: don't install any new builds that might be fetched.
	UpdateFlagsNoDeploy UpdateFlags = 0b1
	// UpdateFlagsNoPull: don't try to fetch new builds from the remote repo.
	UpdateFlagsNoPull UpdateFlags = 0b10
	// UpdateFlagsNoStaticDeltas: don't use static deltas when pulling.
	UpdateFlagsNoStaticDeltas UpdateFlags = 0b100
	// UpdateFlagsNoPrune: don't prune the local OSTree repository after
	// updating (Since: 0.11.8).
	UpdateFlagsNoPrune UpdateFlags = 0b1000
	// UpdateFlagsNoTriggers: don't call triggers after updating. If used, the
	// caller must later call flatpak_installation_run_triggers() to update the
	// exported files. (Since: 1.0.3).
	UpdateFlagsNoTriggers UpdateFlags = 0b10000
)

func (UpdateFlags) Has

func (u UpdateFlags) Has(other UpdateFlags) bool

Has returns true if u contains other.

func (UpdateFlags) String

func (u UpdateFlags) String() string

String returns the names in string for UpdateFlags.

Source Files

flatpak-bundle-ref.go flatpak-error.go flatpak-installation.go flatpak-installed-ref.go flatpak-instance.go flatpak-portal-error.go flatpak-ref.go flatpak-related-ref.go flatpak-remote-ref.go flatpak-remote.go flatpak-transaction.go flatpak-version-macros.go flatpak.go

Version
v0.0.0-20230520172532-1a98868389ab (latest)
Published
May 20, 2023
Platform
linux/amd64
Imports
14 packages
Last checked
2 months ago

Tools for package owners.