~thopiekar/zypper/libzypp-manual-import

« back to all changes in this revision

Viewing changes to zypp/target/CommitPackageCache.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
/** \file       zypp/target/CommitPackageCache.h
 
10
 *
 
11
*/
 
12
#ifndef ZYPP_TARGET_COMMITPACKAGECACHE_H
 
13
#define ZYPP_TARGET_COMMITPACKAGECACHE_H
 
14
 
 
15
#include <iosfwd>
 
16
 
 
17
#include "zypp/base/PtrTypes.h"
 
18
#include "zypp/base/Function.h"
 
19
 
 
20
#include "zypp/PoolItem.h"
 
21
#include "zypp/Pathname.h"
 
22
#include "zypp/ManagedFile.h"
 
23
 
 
24
///////////////////////////////////////////////////////////////////
 
25
namespace zypp
 
26
{ /////////////////////////////////////////////////////////////////
 
27
  ///////////////////////////////////////////////////////////////////
 
28
  namespace target
 
29
  { /////////////////////////////////////////////////////////////////
 
30
 
 
31
    ///////////////////////////////////////////////////////////////////
 
32
    //
 
33
    //  CLASS NAME : CommitPackageCache
 
34
    //
 
35
    /** Target::commit helper optimizing package provision.
 
36
    */
 
37
    class CommitPackageCache
 
38
    {
 
39
      friend std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj );
 
40
 
 
41
    public:
 
42
      typedef function<ManagedFile( const PoolItem & pi, bool fromCache_r )> PackageProvider;
 
43
 
 
44
    public:
 
45
      /** Ctor */
 
46
      CommitPackageCache( const Pathname &        rootDir_r,
 
47
                          const PackageProvider & packageProvider_r );
 
48
 
 
49
      /** Dtor */
 
50
      ~CommitPackageCache();
 
51
 
 
52
    public:
 
53
      /** Download(commit) sequence of solvables to compute read ahead. */
 
54
      void setCommitList( std::vector<sat::Solvable> commitList_r );
 
55
      /** \overload */
 
56
      template <class _Iterator>
 
57
      void setCommitList( _Iterator begin_r, _Iterator end_r )
 
58
      { setCommitList( std::vector<sat::Solvable>( begin_r, end_r  ) ); }
 
59
 
 
60
      /** Provide a package. */
 
61
      ManagedFile get( const PoolItem & citem_r );
 
62
      /** \overload */
 
63
      ManagedFile get( sat::Solvable citem_r )
 
64
      { return get( PoolItem(citem_r) ); }
 
65
 
 
66
    public:
 
67
      /** Implementation. */
 
68
      class Impl;
 
69
      /** Ctor taking an implementation. */
 
70
      explicit CommitPackageCache( Impl * pimpl_r );
 
71
    private:
 
72
      /** Pointer to implementation. */
 
73
      RW_pointer<Impl> _pimpl;
 
74
    };
 
75
    ///////////////////////////////////////////////////////////////////
 
76
 
 
77
    /** \relates CommitPackageCache Stream output */
 
78
    std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj );
 
79
 
 
80
    /////////////////////////////////////////////////////////////////
 
81
  } // namespace target
 
82
  ///////////////////////////////////////////////////////////////////
 
83
  /////////////////////////////////////////////////////////////////
 
84
} // namespace zypp
 
85
///////////////////////////////////////////////////////////////////
 
86
#endif // ZYPP_TARGET_COMMITPACKAGECACHE_H