pub struct Updater;
Implementations§
Source§impl Updater
impl Updater
const LEO_BIN_NAME: &'static str = "leo"
const LEO_CACHE_LAST_CHECK_FILE: &'static str = "leo_cache_last_update_check"
const LEO_CACHE_VERSION_FILE: &'static str = "leo_cache_latest_version"
const LEO_REPO_NAME: &'static str = "leo"
const LEO_REPO_OWNER: &'static str = "AleoHQ"
const LEO_UPDATE_CHECK_INTERVAL: Duration = _
Sourcepub fn show_available_releases() -> Result<String>
pub fn show_available_releases() -> Result<String>
Show all available releases for leo
.
Sourcepub fn update_to_latest_release(show_output: bool) -> Result<Status>
pub fn update_to_latest_release(show_output: bool) -> Result<Status>
Update leo
to the latest release.
Sourcepub fn update_available() -> Result<String>
pub fn update_available() -> Result<String>
Check if there is an available update for leo
and return the newest release.
Sourcepub fn read_latest_version() -> Result<Option<String>, CliError>
pub fn read_latest_version() -> Result<Option<String>, CliError>
Read the latest version from the version file.
Sourcepub fn get_cli_string() -> Result<Option<String>, CliError>
pub fn get_cli_string() -> Result<Option<String>, CliError>
Generate the CLI message if a new version is available.
Sourcepub fn print_cli() -> Result<(), CliError>
pub fn print_cli() -> Result<(), CliError>
Display the CLI message if a new version is available.
Sourcepub fn check_for_updates(force: bool) -> Result<bool, CliError>
pub fn check_for_updates(force: bool) -> Result<bool, CliError>
Check for updates, respecting the update interval. (Currently once per day.) If a new version is found, write it to a cache file and alert in every call.
Sourcefn update_check_files(
cache_dir: &Path,
last_check_file: &Path,
version_file: &Path,
latest_version: &str,
) -> Result<(), CliError>
fn update_check_files( cache_dir: &Path, last_check_file: &Path, version_file: &Path, latest_version: &str, ) -> Result<(), CliError>
Updates the check files with the latest version information and timestamp.
This function creates the cache directory if it doesn’t exist, writes the current time to the last check file, and writes the latest version to the version file.
Sourcefn should_check_for_updates(last_check_file: &Path) -> Result<bool, CliError>
fn should_check_for_updates(last_check_file: &Path) -> Result<bool, CliError>
Determines if an update check should be performed based on the last check time.
This function reads the last check timestamp from a file and compares it with the current time to decide if enough time has passed for a new check.
Sourcefn get_current_time() -> Result<u64, CliError>
fn get_current_time() -> Result<u64, CliError>
Gets the current system time as seconds since the Unix epoch.
Sourcefn get_version_file_path() -> PathBuf
fn get_version_file_path() -> PathBuf
Get the path to the file storing the latest version information.
Sourcefn get_cache_dir() -> PathBuf
fn get_cache_dir() -> PathBuf
Get the cache directory for Leo.
Auto Trait Implementations§
impl Freeze for Updater
impl RefUnwindSafe for Updater
impl Send for Updater
impl Sync for Updater
impl Unpin for Updater
impl UnwindSafe for Updater
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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