~thopiekar/zypper/libzypp-manual-import

« back to all changes in this revision

Viewing changes to zypp/repo/yum/Downloader.h

  • Committer: Thomas-Karl Pietrowski
  • Date: 2014-01-29 22:44:28 UTC
  • Revision ID: thopiekar@googlemail.com-20140129224428-gpcqnsdakby362n8
firstĀ import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*---------------------------------------------------------------------\
 
2
|                          ____ _   __ __ ___                          |
 
3
|                         |__  / \ / / . \ . \                         |
 
4
|                           / / \ V /|  _/  _/                         |
 
5
|                          / /__ | | | | | |                           |
 
6
|                         /_____||_| |_| |_|                           |
 
7
|                                                                      |
 
8
\---------------------------------------------------------------------*/
 
9
 
 
10
#ifndef ZYPP_SOURCE_YUM_DOWNLOADER
 
11
#define ZYPP_SOURCE_YUM_DOWNLOADER
 
12
 
 
13
#include "zypp/Url.h"
 
14
#include "zypp/Pathname.h"
 
15
#include "zypp/Fetcher.h"
 
16
#include "zypp/OnMediaLocation.h"
 
17
#include "zypp/MediaSetAccess.h"
 
18
#include "zypp/ProgressData.h"
 
19
#include "zypp/RepoInfo.h"
 
20
#include "zypp/RepoStatus.h"
 
21
#include "zypp/repo/Downloader.h"
 
22
#include "zypp/repo/yum/ResourceType.h"
 
23
 
 
24
namespace zypp
 
25
{
 
26
  namespace repo
 
27
  {
 
28
    namespace yum
 
29
    {
 
30
     /**
 
31
      * \short Downloader for YUM (rpm-nmd) repositories
 
32
      * Encapsulates all the knowledge of which files have
 
33
      * to be downloaded to the local disk.
 
34
      *
 
35
      * \code
 
36
      * MediaSetAccess media(url);
 
37
      * Downloader yum(path);
 
38
      * yum.download( media, "localdir");
 
39
      * \endcode
 
40
      */
 
41
      class Downloader : public repo::Downloader
 
42
      {
 
43
      public:
 
44
         
 
45
        /**
 
46
         * \short Constructor from the repository information
 
47
         *
 
48
         * The repository information allows more context to be given
 
49
         * to the user when something fails.
 
50
         *
 
51
         * \param info Repository information
 
52
         */
 
53
        Downloader( const RepoInfo &info , const Pathname &delta_dir = Pathname());
 
54
 
 
55
        /**
 
56
         * \short Download metadata to a local directory
 
57
         *
 
58
         * \param media Media access to the repository url
 
59
         * \param dest_dir Local destination directory
 
60
         * \param progress progress receiver
 
61
         */
 
62
        void download( MediaSetAccess &media,
 
63
                       const Pathname &dest_dir,
 
64
                       const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
 
65
        
 
66
        /**
 
67
         * \short Status of the remote repository
 
68
         */
 
69
        RepoStatus status( MediaSetAccess &media );
 
70
        
 
71
       protected:
 
72
        bool repomd_Callback( const OnMediaLocation &loc, const ResourceType &dtype );
 
73
        bool patches_Callback( const OnMediaLocation &loc, const std::string &id );
 
74
       private:
 
75
        Pathname _dest_dir;
 
76
        Pathname _delta_dir;
 
77
        std::list<OnMediaLocation> _patches_files;
 
78
        
 
79
        MediaSetAccess *_media_ptr;
 
80
      };
 
81
 
 
82
    } // ns yum
 
83
  } // ns source
 
84
} // ns zypp
 
85
 
 
86
#endif