Skip to main content

Crate gpui_updater

Crate gpui_updater 

Source
Expand description

GPUI integration: an observable Entity<Updater> that drives the blocking UpdateEngine on the app’s executors, or an external UpdateDriver.

The update runs on the background executor so the UI thread never blocks; state transitions land back on the foreground via the entity and call Context::notify, so any view can cx.observe(&updater, …) to re-render. When an update is staged, App::set_restart_path is set so the next cx.restart() launches the new version.

With Updater::with_driver, an external UpdateDriver (such as Sparkle, via gpui-updater-sparkle) runs the whole flow instead and reports DriverEvents, which the entity maps onto the same UpdateStatus. Views do not need to know which backend is in use.

fn build(cx: &mut Context<()>) {
    let source = GitHubSource::new("AprilNEA", "OpenLogi")
        .asset_contains("macos")
        .asset_contains(".dmg")
        .with_checksums("SHA256SUMS");
    let version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
    let updater: Entity<Updater> =
        cx.new(|cx| Updater::new(source, EngineConfig::new(version), cx));

    // Manual, opt-in check (no background polling):
    updater.update(cx, |u, cx| u.check(cx));
}

Modules§

driver
The contract for handing the whole update flow to an external updater.
install
Replacing the installed application with a freshly downloaded artifact.
source
Where to look for releases.
verify
Integrity and authenticity checks for downloaded artifacts.

Structs§

AppcastSource
Reads releases from a Sparkle appcast.
Artifact
A downloaded update that passed the engine’s checks, ready for UpdateEngine::install.
Asset
A downloadable file attached to a release.
CancelToken
Asks a running UpdateEngine::download_cancellable to stop.
DeltaAsset
A binary delta that upgrades one specific installed version to another.
DriverEvents
Where an UpdateDriver sends its DriverEvents.
EngineConfig
Configuration for an UpdateEngine.
FallbackSource
Asks several sources in order and returns the release from the first one that answers: a mirror or a second host for when the primary is down.
GitHubSource
Reads releases from a GitHub repository’s Releases.
HttpOptions
HTTP settings for an update source or for the engine’s downloads: extra request headers and the proxy.
InstallOptions
How install_with installs an update.
Installed
Outcome of installing an update.
OwnershipHints
What ownership may use beyond the install location.
Release
The latest applicable release resolved for the running platform.
StaticManifestSource
Reads release metadata from a static JSON manifest.
UpdateEngine
Blocking update orchestrator: check → download → verify → install.
UpdateError
A failed update operation, as the user interface sees it: what kind of failure it was and the message describing it.
Updater
A GPUI entity that checks for, downloads, and installs updates.
Version
Re-exported so consumers can build an EngineConfig without depending on semver directly (e.g. Version::parse(env!("CARGO_PKG_VERSION"))). SemVer version as defined by https://semver.org.

Enums§

AppcastVersion
Which appcast field holds the version that is compared and reported.
BundleVersion
Whether the app bundle of an update must declare the release’s version (macOS).
CodeSigning
Which code signature an update must carry: the app bundle’s on macOS, the .exe or .msi Authenticode signature on Windows. Linux has no platform code signature, so nothing is checked there.
DriverEvent
Something an UpdateDriver wants the app to know.
Error
Errors produced while checking for, downloading, verifying, or installing an update.
ErrorKind
The broad class of an Error, stable enough to drive user interface decisions: which message to show, and whether retrying can help.
MsiUi
How much of the Windows Installer UI an .msi update shows. The package installs after the app exits.
Ownership
Who keeps the installed app up to date.
PackageManager
The package managers ownership recognizes.
UpdateStatus
Observable state of an update operation.
Verification
How strictly UpdateEngine enforces integrity and authenticity checks on a release.
VersionBinding
Whether a signature must name the version it was made for.

Constants§

DEFAULT_MAX_DELTA_HOPS
Longest chain of deltas the engine downloads by default.
DEFAULT_MAX_DOWNLOAD_SIZE
Largest download the engine accepts by default: 4 GiB, twice what GitHub Releases allows for a single asset.
DELTA_FORMAT_FILES_BSDIFF_V1
Format identifier of the deltas produced by the delta feature’s delta::create: per-file bsdiff patches against the installed tree.

Traits§

UpdateDriver
An external updater that runs the whole check → download → install → relaunch flow by itself.
UpdateSource
A source of release metadata.

Functions§

current_install_root
Best-effort path of the currently installed application to replace.
parse_tag
Parse a release tag such as v1.2.3 or 1.2.3 into a Version.
parse_version_lenient
Parse a version the way feeds that are not strictly semver publish it.

Type Aliases§

Result
Convenience alias for results returned by this crate.