Skip to main content

EngineConfig

Struct EngineConfig 

Source
#[non_exhaustive]
pub struct EngineConfig {
Show 14 fields pub current_version: Version, pub minisign_public_keys: Vec<String>, pub ed25519_public_key: Option<String>, pub verification: Verification, pub version_binding: VersionBinding, pub code_signing: CodeSigning, pub bundle_version: BundleVersion, pub install_root: Option<PathBuf>, pub download_dir: Option<PathBuf>, pub max_download_size: u64, pub deltas: bool, pub max_delta_hops: usize, pub http: HttpOptions, pub install_options: InstallOptions,
}
Expand description

Configuration for an UpdateEngine.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§current_version: Version

The currently running version, compared against the source’s latest.

§minisign_public_keys: Vec<String>

Base64 minisign public keys. A signature made by any of them is accepted, so a new key can ship next to the old one before releases switch to it.

§ed25519_public_key: Option<String>

Base64 Ed25519 public key in Sparkle’s format (the SUPublicEDKey value printed by Sparkle’s generate_keys). When set and the release publishes an ed25519_signature, the download is signature-checked.

§verification: Verification

How strictly downloads are verified. See Verification.

§version_binding: VersionBinding

Whether signatures must name the version they were made for.

§code_signing: CodeSigning

Which code signature the update must carry (macOS).

§bundle_version: BundleVersion

Whether the update’s bundle version must equal the release (macOS).

§install_root: Option<PathBuf>

Where to install. Defaults to crate::install::current_install_root.

§download_dir: Option<PathBuf>

Directory for downloads. Defaults to a fresh temp directory that only the current user can access. A directory set here should not be writable by other users either; the engine creates it (and missing parents) with owner-only permissions if it does not exist.

§max_download_size: u64

Largest file, in bytes, the engine downloads: a release publishing a larger size is refused before anything is fetched, and a body growing past this is cut off even when no size is published. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.

§deltas: bool

Whether to try published binary deltas before the full artifact. Defaults to true; only takes effect with the delta feature on macOS and Linux.

§max_delta_hops: usize

Longest chain of deltas to download when none starts at the installed version. Defaults to DEFAULT_MAX_DELTA_HOPS.

§http: HttpOptions

Extra headers and the proxy for artifacts, deltas, and their checksum and signature files. Sources have their own.

§install_options: InstallOptions

How UpdateEngine::install installs the update, such as the Windows Installer UI for an .msi.

Implementations§

Source§

impl EngineConfig

Source

pub fn new(current_version: Version) -> EngineConfig

Start a config for the given running version.

Source

pub fn minisign_public_key(self, key: impl Into<String>) -> EngineConfig

Trust a base64 minisign public key. Call again to trust several, for example while rotating keys.

Source

pub fn ed25519_public_key(self, key: impl Into<String>) -> EngineConfig

Set the base64 Ed25519 public key (Sparkle’s SUPublicEDKey) used to verify sparkle:edSignature signatures.

Source

pub fn verification(self, verification: Verification) -> EngineConfig

Set how strictly downloads are verified. Defaults to Verification::BestEffort.

Source

pub fn version_binding(self, binding: VersionBinding) -> EngineConfig

Set whether signatures must name their version. Defaults to VersionBinding::IfPresent.

Source

pub fn code_signing(self, code_signing: CodeSigning) -> EngineConfig

Set which code signature updates must carry. Defaults to CodeSigning::MatchInstalled.

Source

pub fn install_options(self, options: InstallOptions) -> EngineConfig

Set how updates are installed. Defaults to InstallOptions::new.

Source

pub fn bundle_version(self, bundle_version: BundleVersion) -> EngineConfig

Set whether bundle versions are compared. Defaults to BundleVersion::MustMatch.

Source

pub fn install_root(self, path: impl Into<PathBuf>) -> EngineConfig

Override the install location (defaults to the running app/bundle).

Source

pub fn download_dir(self, path: impl Into<PathBuf>) -> EngineConfig

Override the download directory (defaults to a fresh temp directory for each download).

A configured directory persists between downloads, so an artifact that an earlier download left there is reused instead of downloaded again — but only if it has the published size and passes a published checksum or signature and the payload check. Without a checksum or signature to check it against, the file is downloaded again.

Source

pub fn max_download_size(self, bytes: u64) -> EngineConfig

Set the largest file, in bytes, the engine downloads. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.

Source

pub fn deltas(self, enabled: bool) -> EngineConfig

Enable or disable trying binary deltas before the full artifact. Defaults to true. Has no effect without the delta feature.

Source

pub fn max_delta_hops(self, hops: usize) -> EngineConfig

Set the longest chain of deltas to download. 1 only uses a delta from the installed version itself.

Source

pub fn http(self, http: HttpOptions) -> EngineConfig

Download with http’s extra headers and proxy: the artifact, deltas, and their checksum and signature files. Metadata requests use the options set on the source.

Trait Implementations§

Source§

impl Clone for EngineConfig

Source§

fn clone(&self) -> EngineConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more