libzypp  13.10.6
MediaInfoDownloader.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 
10 #include <fstream>
11 #include "zypp/base/String.h"
12 #include "zypp/base/Logger.h"
13 #include "zypp/base/Function.h"
14 
15 #include "MediaInfoDownloader.h"
17 
18 using namespace std;
19 
20 namespace zypp
21 {
22 namespace repo
23 {
24 
25 void downloadMediaInfo( const Pathname &dest_dir,
26  MediaSetAccess &media,
27  const ProgressData::ReceiverFnc & progressrcv )
28 {
29  Fetcher fetcher;
30  fetcher.enqueue( OnMediaLocation("/media.1/media") );
31  fetcher.start( dest_dir, media, progressrcv );
32  // ready, go!
33  fetcher.reset();
34 }
35 
36 }// ns repo
37 } // ns zypp
38 
39 
40 
Describes a path on a certain media amongs as the information required to download it...
void downloadMediaInfo(const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progressrcv)
Downloads the media info (/media.1) to a local directory.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition: ProgressData.h:144
void reset()
Reset the transfer (jobs) list.
Definition: Fetcher.cc:907
void start(const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
start the transfer to a destination directory dest_dir You have to provde a media set access media to...
Definition: Fetcher.cc:912
void enqueue(const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
Enqueue a object for transferal, they will not be transfered until start() is called.
Definition: Fetcher.cc:897
This class allows to retrieve a group of files in a confortable way, providing some smartness that do...
Definition: Fetcher.h:105
Media access layer responsible for handling files distributed on a set of media with media change and...