/// Returns a future that updates and validates the local repository.
///
/// The future periodically runs an update and validation on `repo`. It
/// sdds the result to `history`. If there are changes, it also triggers
/// a notification on `notify`. 
Returns a future that updates and validates the local repository.
The future periodically runs an update and validation on `repo`. It
sdds the result to `history`. If there are changes, it also triggers
a notification on `notify`.
Returns a future that updates and validates the local repository . The future periodically runs an update and validation on ` repo ` . It sdds the result to ` history ` . If there are changes it also triggers a notification on ` notify ` .
fn update_future(
        repo: Repository,
        history: OriginsHistory,
        notify: NotifySender,
        config: Config,
    ) -> impl Future<Item=(), Error=Error> {
        future::loop_fn(
            (repo, history, notify, config),
            |(repo, history, mut notify, config)| {
                Delay::new(Instant::now() + config.refresh)
                .map_err(|e| {
                    error!("Fatal: wait timer failed ({})", e);
                    Error
                })
                .and_then(move |_| {
                    repo.start();
                    Ok(repo)
                })
                .and_then(|repo| {
                    info!("Updating the local repository.");
                    repo.update_async().map(|()| repo)
                })
                .and_then(|repo| {
                    info!("Starting validation of local repository.");
                    repo.process_async()
                    .and_then(move |origins| {
                        info!("Loading exceptions.");
                        let must_notify = match repo.load_exceptions(&config) {
                            Ok(exceptions) => {
                                history.update(
                                    Some(origins),
                                    &exceptions,
                                    false
                                )
                            }
                            Err(_) => {
                                warn!(
                                    "Failed to load exceptions. \
                                     Discarding this validation run but \
                                     continuing."
                                );
                                false
                            }
                        };
                        info!("New serial is {}.", history.serial());
                        if must_notify {
                            info!("Sending out notifications.");
                            notify.notify();
                        }
                        Ok(future::Loop::Continue(
                            (repo, history, notify, config))
                        )
                    })
                })
            }
        )
    }
fn update_future ( repo : Repository , history : OriginsHistory , notify : NotifySender , config : Config , ) -> impl Future < Item = ( ) , Error = Error > { future :: loop_fn ( ( repo , history , notify , config ) , | ( repo , history , mut notify , config ) | { Delay :: new ( Instant :: now ( ) + config . refresh ) . map_err ( | e | { error ! ( " " e ) ; Error } ) . and_then ( move | _ | { repo . start ( ) ; Ok ( repo ) } ) . and_then ( | repo | { info ! ( " " ) ; repo . update_async ( ) . map ( | ( ) | repo ) } ) . and_then ( | repo | { info ! ( " " ) ; repo . process_async ( ) . and_then ( move | origins | { info ! ( " " ) ; let must_notify = match repo . load_exceptions ( & config ) { Ok ( exceptions ) => { history . update ( Some ( origins ) , & exceptions , false ) } Err ( _ ) => { warn ! ( " \
 \
 " ) ; false } } ; info ! ( " " history serial ( ) ) ; if must_notify { info ! ( " " ) ; notify . notify ( ) ; } Ok ( future :: Loop :: Continue ( ( repo , history , notify , config ) ) ) } ) } ) } ) }
Returns a future that updates and validates the local repository.
Returns a future that updates and validates the local repository .
repo
Repository
history
OriginsHistory
notify
NotifySender
config
Config