Trait libflatpak::prelude::TransactionExt
source · pub trait TransactionExt:
IsA<Transaction>
+ Sealed
+ 'static {
Show 48 methods
// Provided methods
fn abort_webflow(&self, id: u32) { ... }
fn add_default_dependency_sources(&self) { ... }
fn add_dependency_source(&self, installation: &impl IsA<Installation>) { ... }
fn add_install(
&self,
remote: &str,
ref_: &str,
subpaths: &[&str],
) -> Result<(), Error> { ... }
fn add_install_bundle(
&self,
file: &impl IsA<File>,
gpg_data: Option<&Bytes>,
) -> Result<(), Error> { ... }
fn add_install_flatpakref(
&self,
flatpakref_data: &Bytes,
) -> Result<(), Error> { ... }
fn add_sideload_repo(&self, path: &str) { ... }
fn add_uninstall(&self, ref_: &str) -> Result<(), Error> { ... }
fn add_update(
&self,
ref_: &str,
subpaths: &[&str],
commit: Option<&str>,
) -> Result<(), Error> { ... }
fn complete_basic_auth(
&self,
id: u32,
user: &str,
password: &str,
options: &Variant,
) { ... }
fn is_auto_install_debug(&self) -> bool { ... }
fn is_auto_install_sdk(&self) -> bool { ... }
fn current_operation(&self) -> Option<TransactionOperation> { ... }
fn is_include_unused_uninstall_ops(&self) -> bool { ... }
fn installation(&self) -> Option<Installation> { ... }
fn is_no_deploy(&self) -> bool { ... }
fn is_no_interaction(&self) -> bool { ... }
fn is_no_pull(&self) -> bool { ... }
fn operation_for_ref(
&self,
remote: Option<&str>,
ref_: &str,
) -> Result<TransactionOperation, Error> { ... }
fn operations(&self) -> Vec<TransactionOperation> { ... }
fn parent_window(&self) -> Option<GString> { ... }
fn is_empty(&self) -> bool { ... }
fn run(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error> { ... }
fn set_auto_install_debug(&self, auto_install_debug: bool) { ... }
fn set_auto_install_sdk(&self, auto_install_sdk: bool) { ... }
fn set_default_arch(&self, arch: &str) { ... }
fn set_disable_auto_pin(&self, disable_pin: bool) { ... }
fn set_disable_dependencies(&self, disable_dependencies: bool) { ... }
fn set_disable_prune(&self, disable_prune: bool) { ... }
fn set_disable_related(&self, disable_related: bool) { ... }
fn set_disable_static_deltas(&self, disable_static_deltas: bool) { ... }
fn set_force_uninstall(&self, force_uninstall: bool) { ... }
fn set_include_unused_uninstall_ops(
&self,
include_unused_uninstall_ops: bool,
) { ... }
fn set_no_deploy(&self, no_deploy: bool) { ... }
fn set_no_interaction(&self, no_interaction: bool) { ... }
fn set_no_pull(&self, no_pull: bool) { ... }
fn set_parent_window(&self, parent_window: &str) { ... }
fn set_reinstall(&self, reinstall: bool) { ... }
fn connect_add_new_remote<F: Fn(&Self, TransactionRemoteReason, &str, &str, &str) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_basic_auth_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_end_of_lifed<F: Fn(&Self, &str, &str, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_install_authenticator<F: Fn(&Self, &str, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_new_operation<F: Fn(&Self, &TransactionOperation, &TransactionProgress) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_ready<F: Fn(&Self) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_ready_pre_auth<F: Fn(&Self) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_webflow_done<F: Fn(&Self, &Variant, i32) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_webflow_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_no_interaction_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn abort_webflow(&self, id: u32)
fn abort_webflow(&self, id: u32)
Cancel an ongoing webflow authentication request. This can be call
in the time between webflow-start
returned
true
, and 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.
§id
The webflow id, as passed into the webflow-start signal
sourcefn add_default_dependency_sources(&self)
fn add_default_dependency_sources(&self)
Similar to add_dependency_source()
, but adds
all the default installations, which means all the defined system-wide
(but not per-user) installations.
sourcefn add_dependency_source(&self, installation: &impl IsA<Installation>)
fn add_dependency_source(&self, installation: &impl IsA<Installation>)
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 add_default_dependency_sources()
.
§installation
sourcefn add_install(
&self,
remote: &str,
ref_: &str,
subpaths: &[&str],
) -> Result<(), Error>
fn add_install( &self, remote: &str, ref_: &str, subpaths: &[&str], ) -> Result<(), Error>
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.
§remote
the name of the remote
§ref_
the ref
§subpaths
subpaths to install, or the
empty list or None
to pull all subpaths
§Returns
sourcefn add_install_bundle(
&self,
file: &impl IsA<File>,
gpg_data: Option<&Bytes>,
) -> Result<(), Error>
fn add_install_bundle( &self, file: &impl IsA<File>, gpg_data: Option<&Bytes>, ) -> Result<(), Error>
sourcefn add_sideload_repo(&self, path: &str)
fn add_sideload_repo(&self, path: &str)
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.
§path
a path to a local flatpak repository
sourcefn add_update(
&self,
ref_: &str,
subpaths: &[&str],
commit: Option<&str>,
) -> Result<(), Error>
fn add_update( &self, ref_: &str, subpaths: &[&str], commit: Option<&str>, ) -> Result<(), Error>
sourcefn is_auto_install_debug(&self) -> bool
fn is_auto_install_debug(&self) -> bool
Gets the value set by
set_auto_install_debug()
.
§Returns
sourcefn is_auto_install_sdk(&self) -> bool
fn is_auto_install_sdk(&self) -> bool
Gets the value set by
set_auto_install_sdk()
.
§Returns
sourcefn current_operation(&self) -> Option<TransactionOperation>
fn current_operation(&self) -> Option<TransactionOperation>
sourcefn is_include_unused_uninstall_ops(&self) -> bool
fn is_include_unused_uninstall_ops(&self) -> bool
Gets the value set by
set_include_unused_uninstall_ops()
.
§Returns
true
if include_unused_uninstall_ops is set, false
otherwise
sourcefn installation(&self) -> Option<Installation>
fn installation(&self) -> Option<Installation>
sourcefn is_no_deploy(&self) -> bool
fn is_no_deploy(&self) -> bool
sourcefn is_no_interaction(&self) -> bool
fn is_no_interaction(&self) -> bool
Gets whether the transaction is interactive. See
set_no_interaction()
.
§Returns
sourcefn is_no_pull(&self) -> bool
fn is_no_pull(&self) -> bool
fn operation_for_ref( &self, remote: Option<&str>, ref_: &str, ) -> Result<TransactionOperation, Error>
sourcefn operations(&self) -> Vec<TransactionOperation>
fn operations(&self) -> Vec<TransactionOperation>
Gets the list of operations. Skipped operations are not included. The order of the list is the order in which the operations are executed.
§Returns
a GList
of operations
sourcefn parent_window(&self) -> Option<GString>
fn parent_window(&self) -> Option<GString>
Gets the parent window set for this transaction, or None
if unset. See
parent_window()
.
§Returns
a window name, or None
sourcefn run(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), Error>
fn run(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), Error>
Executes the transaction.
During the course of the execution, various signals will get emitted.
The FlatpakTransaction::choose-remote-for-ref and
add-new-remote
signals may get emitted while
resolving operations. ready
is emitted when
the transaction has been fully resolved, and new-operation
and operation-done
are emitted while the operations
are carried out. If an error occurs at any point during the execution,
operation-error
is emitted.
Note that this call blocks until the transaction is done.
§cancellable
§Returns
sourcefn set_auto_install_debug(&self, auto_install_debug: bool)
fn set_auto_install_debug(&self, auto_install_debug: bool)
sourcefn set_auto_install_sdk(&self, auto_install_sdk: bool)
fn set_auto_install_sdk(&self, auto_install_sdk: bool)
sourcefn set_default_arch(&self, arch: &str)
fn set_default_arch(&self, arch: &str)
sourcefn set_disable_auto_pin(&self, disable_pin: bool)
fn set_disable_auto_pin(&self, disable_pin: bool)
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.
§disable_pin
whether to disable auto-pinning
sourcefn set_disable_dependencies(&self, disable_dependencies: bool)
fn set_disable_dependencies(&self, disable_dependencies: bool)
Sets whether the transaction should ignore runtime dependencies when resolving operations for applications.
§disable_dependencies
whether to disable runtime dependencies
sourcefn set_disable_prune(&self, disable_prune: bool)
fn set_disable_prune(&self, disable_prune: bool)
Sets whether the transaction should avoid pruning the local OSTree repository after updating.
§disable_prune
whether to avoid pruning
Sets whether the transaction should avoid adding related refs when resolving operations. Related refs are extensions that are suggested by apps, such as locales.
§disable_related
whether to avoid adding related refs
sourcefn set_disable_static_deltas(&self, disable_static_deltas: bool)
fn set_disable_static_deltas(&self, disable_static_deltas: bool)
Sets whether the transaction should avoid using static deltas when pulling.
§disable_static_deltas
whether to avoid static deltas
sourcefn set_force_uninstall(&self, force_uninstall: bool)
fn set_force_uninstall(&self, force_uninstall: bool)
Sets whether the transaction should uninstall files even if they’re used by a running application.
§force_uninstall
whether to force-uninstall refs
sourcefn set_include_unused_uninstall_ops(&self, include_unused_uninstall_ops: bool)
fn set_include_unused_uninstall_ops(&self, include_unused_uninstall_ops: bool)
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
InstallationExt::list_unused_refs()
.
§include_unused_uninstall_ops
whether to include unused uninstall ops
sourcefn set_no_deploy(&self, no_deploy: bool)
fn set_no_deploy(&self, no_deploy: bool)
Sets whether the transaction should download updates, but not deploy them.
§no_deploy
whether to avoid deploying
sourcefn set_no_interaction(&self, no_interaction: bool)
fn set_no_interaction(&self, no_interaction: bool)
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.
§no_interaction
Whether to disallow interactive authorization for operations
sourcefn set_no_pull(&self, no_pull: bool)
fn set_no_pull(&self, no_pull: bool)
Sets whether the transaction should operate only on locally available data.
§no_pull
whether to avoid pulls
sourcefn set_parent_window(&self, parent_window: &str)
fn set_parent_window(&self, parent_window: &str)
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.
§parent_window
whether to avoid pulls
sourcefn set_reinstall(&self, reinstall: bool)
fn set_reinstall(&self, reinstall: bool)
Sets whether the transaction should uninstall first if a ref is already installed.
§reinstall
whether to reinstall refs
sourcefn connect_add_new_remote<F: Fn(&Self, TransactionRemoteReason, &str, &str, &str) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_add_new_remote<F: Fn(&Self, TransactionRemoteReason, &str, &str, &str) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::add-new-remote 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
.
§reason
A TransactionRemoteReason
for this suggestion
§from_id
The id of the app/runtime
§suggested_remote_name
The suggested remote name
§url
The repo url
§Returns
true
to add the remote
sourcefn connect_basic_auth_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_basic_auth_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::basic-auth-start 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 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).
§remote
The remote we’re authenticating with
§realm
The url to show
§options
Extra options, currently unused
§id
The id of the operation, can be used to finish it
sourcefn connect_end_of_lifed<F: Fn(&Self, &str, &str, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_end_of_lifed<F: Fn(&Self, &str, &str, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
sourcefn connect_install_authenticator<F: Fn(&Self, &str, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_install_authenticator<F: Fn(&Self, &str, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::install-authenticator 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.
§remote
The remote name
§authenticator_ref
The ref for the authenticator
sourcefn connect_new_operation<F: Fn(&Self, &TransactionOperation, &TransactionProgress) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_new_operation<F: Fn(&Self, &TransactionOperation, &TransactionProgress) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::new-operation signal gets emitted during the execution of the transaction when a new operation is beginning.
§operation
The new TransactionOperation
§progress
A TransactionProgress
for operation
sourcefn connect_ready<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId
fn connect_ready<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId
The ::ready 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 operations()
will return all the operations
that will be executed as part of the transaction.
§Returns
sourcefn connect_ready_pre_auth<F: Fn(&Self) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_ready_pre_auth<F: Fn(&Self) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::ready-pre-auth signal is emitted when all the refs involved in the transaction have been resolved to commits, but we might not necessarily have asked for authentication for all their required operations. This is very similar to the ::ready signal, and you can choose which one (or both) to use depending on how you want to handle authentication in your user interface.
At this point operations()
will return all the
operations that will be executed as part of the transaction. You can call
TransactionOperation::requires_authentication()
to see which
will require authentication.
§Returns
sourcefn connect_webflow_done<F: Fn(&Self, &Variant, i32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_webflow_done<F: Fn(&Self, &Variant, i32) + 'static>( &self, f: F, ) -> SignalHandlerId
sourcefn connect_webflow_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_webflow_start<F: Fn(&Self, &str, &str, &Variant, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::webflow-start 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
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.
§remote
The remote we’re authenticating with
§url
The url to show
§options
Extra options, currently unused
§id
The id of the operation, can be used to cancel it