rename the insert cache method
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 11 Apr 2007 15:51:14 +0000 (15:51 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 11 Apr 2007 15:51:14 +0000 (15:51 +0000)
pass the media set access

zypp/Fetcher.cc
zypp/Fetcher.h

index 970b785..7bfee3e 100644 (file)
@@ -18,8 +18,7 @@ using namespace zypp::filesystem;
 namespace zypp
 {
 
-Fetcher::Fetcher( const Url &url, const Pathname &path )
-  : _url(url), _path(path)
+Fetcher::Fetcher()
 {
 
 }
@@ -35,15 +34,13 @@ void Fetcher::reset()
   _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;
index f26e046..fee5a65 100644 (file)
@@ -14,6 +14,7 @@
 #include "zypp/Pathname.h"
 #include "zypp/Url.h"
 #include "zypp/OnMediaLocation.h"
+#include "zypp/MediaSetAccess.h"
 
 namespace zypp
 {
@@ -25,10 +26,11 @@ 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
   */
@@ -36,9 +38,9 @@ namespace zypp
   {
   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
@@ -49,21 +51,23 @@ namespace zypp
     * 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;
   };