Imported Upstream version 17.22.0
[platform/upstream/libzypp.git] / zypp / repo / yum / Downloader.h
index 5d89350..591c9f4 100644 (file)
 #include "zypp/Fetcher.h"
 #include "zypp/OnMediaLocation.h"
 #include "zypp/MediaSetAccess.h"
-#include "zypp/parser/xml/Reader.h"
-#include "zypp/repo/yum/ResourceType.h"
 #include "zypp/ProgressData.h"
+#include "zypp/RepoInfo.h"
+#include "zypp/RepoStatus.h"
+#include "zypp/repo/Downloader.h"
 
 namespace zypp
 {
@@ -25,39 +26,51 @@ namespace zypp
   {
     namespace yum
     {
-      /**
-      * This class allows to retrieve a YUM repository
-      * to a local directory
+     /**
+      * \short Downloader for YUM (rpm-nmd) repositories
+      * Encapsulates all the knowledge of which files have
+      * to be downloaded to the local disk.
       *
       * \code
-      * Downloader yum(url, path);
-      * yum.download("localdir");
+      * MediaSetAccess media(url);
+      * Downloader yum(path);
+      * yum.download( media, "localdir");
       * \endcode
       */
-      class Downloader
+      class Downloader : public repo::Downloader
       {
-       public:
-       /**
-        * Create the download object for a repository
-        * located in \a url with path \a path
-        */
-        Downloader( const Url &url, const Pathname &path );
-       /**
-        * starts the download to local directory \a dest_dir
-        */
-        void download( const Pathname &dest_dir,
-                       const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
-        
-       protected:
-        bool repomd_Callback( const OnMediaLocation &loc, const ResourceType &dtype );
-        bool patches_Callback( const OnMediaLocation &loc, const std::string &id );
-       private:
-        Url _url;
-        Pathname _path;
-        Fetcher _fetcher;
-        Pathname _dest_dir;
-        std::list<OnMediaLocation> _patches_files;
-        MediaSetAccess _media;
+      public:
+
+        /**
+         * \short Constructor from the repository information
+         *
+         * The repository information allows more context to be given
+         * to the user when something fails.
+         *
+         * \param info Repository information
+         */
+        Downloader( const RepoInfo & info_r, const Pathname & deltaDir_r = Pathname() );
+
+        /**
+         * \short Download metadata to a local directory
+         *
+         * \param media Media access to the repository url
+         * \param destDir Local destination directory
+         * \param progress progress receiver
+         */
+        void download( MediaSetAccess & media_r,
+                       const Pathname & destDir_r,
+                       const ProgressData::ReceiverFnc & progress_r = ProgressData::ReceiverFnc() ) override;
+
+        /**
+         * \short Status of the remote repository
+         */
+        RepoStatus status( MediaSetAccess & media_r ) override;
+
+      private:
+       class Impl;
+       friend class Impl;
+       Pathname _deltaDir;
       };
 
     } // ns yum