Updater

Struct Updater 

Source
pub struct Updater<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Updater<'a>

Source

pub fn new( rulesets: &'a mut RuleSets, update_channels: &'a UpdateChannels, storage: &'a dyn Storage, default_rulesets: Option<String>, periodicity: usize, ) -> Updater<'a>

Returns an updater with the rulesets, update channels, storage, and interval to check for new rulesets

§Arguments
  • rulesets - A ruleset struct to update
  • update_channels - The update channels where to look for new rulesets
  • storage - The storage engine for key-value pairs
  • default_rulesets - An optional string representing the default rulesets, which may or may not be replaced by updates
  • periodicity - The interval to check for new rulesets
Source

pub fn perform_check(&mut self)

Perform a check for updates. For all ruleset update channels:

  1. Check if new rulesets exist by requesting a defined endpoint for a timestamp, which is compared to a stored timestamp
  2. If new rulesets exist, download them along with a signature
  3. Verify if the signature is valid, and if so…
  4. Store the rulesets
Source

pub fn apply_stored_rulesets(&mut self)

Modify rulesets struct to apply the stored rulesets

Source

pub fn time_to_next_check(&self) -> usize

Return the time until we should check for new rulesets, in seconds

Source

pub fn clear_replacement_update_channels(&self)

Clear the stored rulesets for any update channels which replace the default rulesets. This should be run when a new version of the extension is released, so the bundled rulesets are not overwritten by old stored rulesets.

Auto Trait Implementations§

§

impl<'a> Freeze for Updater<'a>

§

impl<'a> !RefUnwindSafe for Updater<'a>

§

impl<'a> !Send for Updater<'a>

§

impl<'a> !Sync for Updater<'a>

§

impl<'a> Unpin for Updater<'a>

§

impl<'a> !UnwindSafe for Updater<'a>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.