libzypp  11.13.5
PackageProvider.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_REPO_PACKAGEPROVIDER_H
13 #define ZYPP_REPO_PACKAGEPROVIDER_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/base/NonCopyable.h"
18 
19 #include "zypp/ZYppCallbacks.h"
20 #include "zypp/Package.h"
21 #include "zypp/ManagedFile.h"
24 
26 namespace zypp
27 {
28 
29  namespace repo
30  {
31 
33  //
34  // CLASS NAME : PackageProviderPolicy
35  //
38  {
39  public:
41  typedef function<bool ( const std::string &, const Edition &, const Arch & )> QueryInstalledCB;
42 
45  { _queryInstalledCB = queryInstalledCB_r; return *this; }
46 
48  bool queryInstalled( const std::string & name_r,
49  const Edition & ed_r,
50  const Arch & arch_r ) const;
51 
52  private:
54  };
56 
58  //
59  // CLASS NAME : PackageProvider
60  //
65  {
66  typedef shared_ptr<void> ScopedGuard;
68 
70 
71  public:
74  const Package::constPtr & package,
75  const DeltaCandidates & deltas,
76  const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
78 
79  public:
84 
85  private:
87  ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
88 
89  private:
90  ScopedGuard newReport() const;
91  Report & report() const;
92  bool progressDeltaDownload( int value ) const;
93  void progressDeltaApply( int value ) const;
94  bool progressPackageDownload( int value ) const;
95  bool failOnChecksumError() const;
96  bool queryInstalled( const Edition & ed_r = Edition() ) const;
97 
98  private:
101  mutable bool _retry;
102  mutable shared_ptr<Report> _report;
105  };
107 
109  } // namespace repo
112 } // namespace zypp
114 #endif // ZYPP_SOURCE_PACKAGEPROVIDER_H