zypp::Fetcher Class Reference

This class allows to retrieve a group of files in a confortable way, providing some smartness that does not belong to the media layer like:. More...

#include <Fetcher.h>

Inheritance diagram for zypp::Fetcher:
[legend]

List of all members.

Public Member Functions

 Fetcher ()
 Default ctor.
virtual ~Fetcher ()
 Dtor.
void enqueue (const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
 Enqueue a object for transferal, they will not be transfered until start() is called.
void enqueueDigested (const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
 Enqueue a object for transferal, they will not be transfered until start() is called.
void addCachePath (const Pathname &cache_dir)
 adds a directory to the list of directories where to look for cached files
void reset ()
 Reset the transfer list and cache list.
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 get the files from The file tree will be replicated inside this directory

Private Attributes

RWCOW_pointer< Impl_pimpl
 Pointer to implementation.

Friends

std::ostream & operator<< (std::ostream &str, const Fetcher &obj)
 Stream output.

Classes

struct  Impl
 Fetcher implementation. More...


Detailed Description

This class allows to retrieve a group of files in a confortable way, providing some smartness that does not belong to the media layer like:.

 MediaSetAccess access(url, path);
 Fetcher fetcher;
 fetcher.enqueue( OnMediaLocation().filename("/content") );
 fetcher.addCachePath("/tmp/cache")
 fetcher.start( "/download-dir, access );
 fetcher.reset();

To use the checkers. just create a functor implementing bool operator()(const Pathname &file)

See also:
FileChecker. Pass the necessary validation data in the constructor of the functor, and pass the object to the enqueue method.
 ChecksumFileChecker checker(CheckSum("sha1", "....");
 fetcher.enqueue( location, checker);

If you need to use more than one checker

See also:
CompositeFileChecker

Definition at line 64 of file Fetcher.h.


Constructor & Destructor Documentation

zypp::Fetcher::Fetcher (  ) 

Default ctor.

Definition at line 257 of file Fetcher.cc.

zypp::Fetcher::~Fetcher (  )  [virtual]

Dtor.

Definition at line 266 of file Fetcher.cc.


Member Function Documentation

void zypp::Fetcher::enqueue ( const OnMediaLocation resource,
const FileChecker checker = FileChecker() 
)

Enqueue a object for transferal, they will not be transfered until start() is called.

Definition at line 274 of file Fetcher.cc.

References _pimpl.

Referenced by zypp::repo::yum::Downloader::download(), zypp::repo::susetags::Downloader::download(), and zypp::repo::downloadMediaInfo().

void zypp::Fetcher::enqueueDigested ( const OnMediaLocation resource,
const FileChecker checker = FileChecker() 
)

Enqueue a object for transferal, they will not be transfered until start() is called.

Note:
As OnMediaLocation contains the digest information, a ChecksumFileChecker is automatically added to the transfer job, so make sure you don't add another one or the user could be asked twice.
Todo:
FIXME implement checker == operator to avoid this.

Definition at line 269 of file Fetcher.cc.

References _pimpl.

Referenced by zypp::repo::susetags::Downloader::download(), and zypp::repo::yum::Downloader::repomd_Callback().

void zypp::Fetcher::addCachePath ( const Pathname &  cache_dir  ) 

adds a directory to the list of directories where to look for cached files

Definition at line 279 of file Fetcher.cc.

References _pimpl.

void zypp::Fetcher::reset (  ) 

Reset the transfer list and cache list.

Definition at line 284 of file Fetcher.cc.

References _pimpl.

Referenced by zypp::repo::yum::Downloader::download(), zypp::repo::susetags::Downloader::download(), and zypp::repo::downloadMediaInfo().

void zypp::Fetcher::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 get the files from The file tree will be replicated inside this directory

Definition at line 289 of file Fetcher.cc.

References _pimpl.

Referenced by zypp::repo::yum::Downloader::download(), zypp::repo::susetags::Downloader::download(), zypp::repo::downloadMediaInfo(), and zypp::repo::yum::Downloader::repomd_Callback().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const Fetcher obj 
) [friend]

Stream output.

Definition at line 302 of file Fetcher.cc.


Member Data Documentation

RWCOW_pointer<Impl> zypp::Fetcher::_pimpl [private]

Pointer to implementation.

Definition at line 127 of file Fetcher.h.

Referenced by addCachePath(), enqueue(), enqueueDigested(), zypp::operator<<(), reset(), and start().


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 19:23:14 2007 for libzypp by  doxygen 1.5.3