add mkdir for services and modifyServices, which is used during refresh
[platform/upstream/libzypp.git] / zypp / RepoManager.h
index 70e676b..cfcfa1c 100644 (file)
@@ -27,6 +27,7 @@
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
+  class Service; //predef
 
    /**
     * Parses \a repo_file and returns a list of \ref RepoInfo objects
@@ -47,15 +48,41 @@ namespace zypp
    */
   struct RepoManagerOptions
   {
-    RepoManagerOptions();
+    /** Default ctor following \ref ZConfig global settings.
+     * If an optional \c root_r directory is given, all paths  will
+     * be prefixed accordingly.
+     * \code
+     *    root_r\repoCachePath
+     *          \repoRawCachePath
+     *          \repoSolvCachePath
+     *          \repoPackagesCachePath
+     *          \knownReposPath
+     * \endcode
+     */
+    RepoManagerOptions( const Pathname & root_r = Pathname() );
+
+    /** Test setup adjusting all paths to be located below one \c root_r directory.
+     * \code
+     *    root_r\          - repoCachePath
+     *          \raw       - repoRawCachePath
+     *          \solv      - repoSolvCachePath
+     *          \packages  - repoPackagesCachePath
+     *          \repos.d   - knownReposPath
+     * \endcode
+     */
+    static RepoManagerOptions makeTestSetup( const Pathname & root_r );
 
     Pathname repoCachePath;
     Pathname repoRawCachePath;
+    Pathname repoSolvCachePath;
     Pathname repoPackagesCachePath;
     Pathname knownReposPath;
+    Pathname knownServicesPath;
     bool probe;
   };
 
+
+
   /**
    * \short creates and provides information about known sources.
    *
@@ -68,6 +95,11 @@ namespace zypp
     /** Implementation  */
     class Impl;
 
+    /** service typedefs */
+    typedef std::set<Service> ServiceSet;
+    typedef ServiceSet::const_iterator ServiceConstIterator;
+    typedef ServiceSet::size_type ServiceSizeType;
+
   public:
    RepoManager( const RepoManagerOptions &options = RepoManagerOptions() );
    /** Dtor */
@@ -162,7 +194,7 @@ namespace zypp
      * \param info
      * \param url
      * \param policy
-     * \return state of repository 
+     * \return state of repository
      * \see RefreshCheckStatus
      * \throws RepoUnknownTypeException
      * \throws repo::RepoNoAliasException if can't figure an alias
@@ -185,6 +217,20 @@ namespace zypp
      */
     Pathname metadataPath( const RepoInfo &info ) const;
 
+
+    /**
+     * \short Path where the rpm packages are downloaded and kept
+     *
+     * Given a repoinfo, tells where \ref RepoProvidePackage will download
+     * and keep the .rpm files.
+     *
+     * \param info Repository information
+     *
+     * \throws repo::RepoNoAliasException if can't figure an alias
+     */
+    Pathname packagesPath( const RepoInfo &info ) const;
+
+
    /**
     * \short Refresh local raw cache
     *
@@ -268,11 +314,6 @@ namespace zypp
                     const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
 
    /**
-    * Clean target system (rpm db) cache.
-    */
-   void cleanTargetCache(const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc());
-
-   /**
     * \short Whether a repository exists in cache
     *
     * \param RepoInfo to be checked.
@@ -389,9 +430,31 @@ namespace zypp
                                 const url::ViewOption & urlview = url::ViewOption::DEFAULTS,
                                 const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
 
+    void addService( const std::string& name, const Url& url );
+
+    void removeService( const std::string& name );
+
+    bool serviceEmpty() const;
+
+    ServiceSizeType serviceSize() const;
+
+    ServiceConstIterator serviceBegin() const;
+
+    ServiceConstIterator serviceEnd() const;
+
+    const Service& getService( const std::string& name ) const;
+
+    void refreshServices();
+
+    /**
+     * modify service, except name change
+     * ( you need remove and add if you want change name )
+     */
+    void modifyService(const Service& service) const;
+
   protected:
     RepoStatus rawMetadataStatus( const RepoInfo &info );
-    void setCacheStatus( const std::string &alias, const RepoStatus &status );
+    void setCacheStatus( const RepoInfo &info, const RepoStatus &status );
 
     /**
      * Update timestamp of repository index file for the specified repository \a info.