pub struct Updater<'a> { /* private fields */ }Implementations§
Source§impl<'a> Updater<'a>
impl<'a> Updater<'a>
Sourcepub fn new(
rulesets: &'a mut RuleSets,
update_channels: &'a UpdateChannels,
storage: &'a dyn Storage,
default_rulesets: Option<String>,
periodicity: usize,
) -> Updater<'a>
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 updateupdate_channels- The update channels where to look for new rulesetsstorage- The storage engine for key-value pairsdefault_rulesets- An optional string representing the default rulesets, which may or may not be replaced by updatesperiodicity- The interval to check for new rulesets
Sourcepub fn perform_check(&mut self)
pub fn perform_check(&mut self)
Perform a check for updates. For all ruleset update channels:
- Check if new rulesets exist by requesting a defined endpoint for a timestamp, which is compared to a stored timestamp
- If new rulesets exist, download them along with a signature
- Verify if the signature is valid, and if so…
- Store the rulesets
Sourcepub fn apply_stored_rulesets(&mut self)
pub fn apply_stored_rulesets(&mut self)
Modify rulesets struct to apply the stored rulesets
Sourcepub fn time_to_next_check(&self) -> usize
pub fn time_to_next_check(&self) -> usize
Return the time until we should check for new rulesets, in seconds
Sourcepub fn clear_replacement_update_channels(&self)
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> 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
Mutably borrows from an owned value. Read more