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§
- Appcast
Source - 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.
- Cancel
Token - Asks a running
UpdateEngine::download_cancellableto stop. - Delta
Asset - A binary delta that upgrades one specific installed version to another.
- Driver
Events - Where an
UpdateDriversends itsDriverEvents. - Engine
Config - Configuration for an
UpdateEngine. - Fallback
Source - 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.
- GitHub
Source - Reads releases from a GitHub repository’s Releases.
- Http
Options - HTTP settings for an update source or for the engine’s downloads: extra request headers and the proxy.
- Install
Options - How
install_withinstalls an update. - Installed
- Outcome of installing an update.
- Ownership
Hints - What
ownershipmay use beyond the install location. - Release
- The latest applicable release resolved for the running platform.
- Static
Manifest Source - Reads release metadata from a static JSON manifest.
- Update
Engine - Blocking update orchestrator: check → download → verify → install.
- Update
Error - 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
EngineConfigwithout depending onsemverdirectly (e.g.Version::parse(env!("CARGO_PKG_VERSION"))). SemVer version as defined by https://semver.org.
Enums§
- Appcast
Version - Which appcast field holds the version that is compared and reported.
- Bundle
Version - Whether the app bundle of an update must declare the release’s version (macOS).
- Code
Signing - Which code signature an update must carry: the app bundle’s on macOS, the
.exeor.msiAuthenticode signature on Windows. Linux has no platform code signature, so nothing is checked there. - Driver
Event - Something an
UpdateDriverwants the app to know. - Error
- Errors produced while checking for, downloading, verifying, or installing an update.
- Error
Kind - 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
.msiupdate shows. The package installs after the app exits. - Ownership
- Who keeps the installed app up to date.
- Package
Manager - The package managers
ownershiprecognizes. - Update
Status - Observable state of an update operation.
- Verification
- How strictly
UpdateEngineenforces integrity and authenticity checks on a release. - Version
Binding - 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
deltafeature’sdelta::create: per-file bsdiff patches against the installed tree.
Traits§
- Update
Driver - An external updater that runs the whole check → download → install → relaunch flow by itself.
- Update
Source - 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.3or1.2.3into aVersion. - 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.