namespace zypp
{
-Fetcher::Fetcher( const Url &url, const Pathname &path )
- : _url(url), _path(path)
+Fetcher::Fetcher()
{
}
_caches.clear();
}
-void Fetcher::insertCache( const Pathname &cache_dir )
+void Fetcher::addCachePath( const Pathname &cache_dir )
{
_caches.push_back(cache_dir);
}
-void Fetcher::start( const Pathname &dest_dir )
+void Fetcher::start( const Pathname &dest_dir, MediaSetAccess &media )
{
- MediaSetAccess media(_url, _path);
-
for ( list<OnMediaLocation>::const_iterator it_res = _resources.begin(); it_res != _resources.end(); ++it_res )
{
bool got_from_cache = false;
#include "zypp/Pathname.h"
#include "zypp/Url.h"
#include "zypp/OnMediaLocation.h"
+#include "zypp/MediaSetAccess.h"
namespace zypp
{
* be cached already on the local disk.
*
* \code
- * Fetcher fetcher(url, path);
+ * MediaSetAccess access(url, path);
+ * Fetcher fetcher;
* fetcher.enqueue( OnMediaLocation().filename("/content") );
- * fetcher.insertCache("/tmp/cache")
- * fetcher.start( "/download-dir );
+ * fetcher.addCachePath("/tmp/cache")
+ * fetcher.start( "/download-dir, access );
* fetcher.reset();
* \endcode
*/
{
public:
/**
- * Constructs a fetcher from a url and path
+ * Constructor
*/
- Fetcher( const Url &url, const Pathname &path );
+ Fetcher();
/**
* Enqueue a object for transferal, they will not
* adds a directory to the list of directories
* where to look for cached files
*/
- void insertCache( const Pathname &cache_dir );
+ void addCachePath( const Pathname &cache_dir );
/**
* Reset the transfer list and cache list
*/
void reset();
/**
* start the transfer to a destination directory
+ * \a dest_dir
+ * You have to provde a media set access
+ * \a media to get the files from
* The file tree will be replicated inside this
* directory
+ *
*/
- void start( const Pathname &dest_dir );
+ void start( const Pathname &dest_dir, MediaSetAccess &media );
private:
- Url _url;
- Pathname _path;
std::list<OnMediaLocation> _resources;
std::list<Pathname> _caches;
};