Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / ZYpp.h
index fc65fe2..f193f97 100644 (file)
 #include "zypp/base/ReferenceCounted.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
+#include "zypp/APIConfig.h"
+
+#include "zypp/ZConfig.h"
+#include "zypp/ManagedFile.h"
+
+#include "zypp/ZYppCommit.h"
+#include "zypp/ResTraits.h"
+
 #include "zypp/Target.h"
+#include "zypp/Resolver.h"
+#include "zypp/KeyRing.h"
+#include "zypp/DiskUsageCounter.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -30,13 +41,17 @@ namespace zypp
 
   class ZYppFactory;
   class ResPool;
-  class ResStore;
+  class ResPoolProxy;
+  class KeyRing;
 
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : ZYpp
   //
-  /** */
+  /**
+   * \todo define Exceptions
+   * ZYpp API main interface
+   */
   class ZYpp : public base::ReferenceCounted, private base::NonCopyable
   {
   public:
@@ -45,28 +60,85 @@ namespace zypp
     typedef intrusive_ptr<const ZYpp> constPtr;
 
   public:
-    /**  */
+
+    /**
+     * Access to the global resolvable pool.
+     * Same as \ref zypp::ResPool::instance
+     */
     ResPool pool() const;
-    
-    void addResolvables (const ResStore& store, bool installed = false);
 
-    void removeResolvables (const ResStore& store);
+    /** Pool of ui::Selectable.
+     * Based on the ResPool, ui::Selectable groups ResObjetcs of
+     * same kind and name.
+    */
+    ResPoolProxy poolProxy() const;
+
+    DiskUsageCounter::MountPointSet diskUsage();
+
+    void setPartitions(const DiskUsageCounter::MountPointSet &mp);
 
+    DiskUsageCounter::MountPointSet getPartitions() const;
+
+  public:
     /**
      * \throws Exception
      */
     Target_Ptr target() const;
 
+    /** Same as \ref target but returns NULL if target is not
+     *  initialized, instead of throwing.
+     */
+    Target_Ptr getTarget() const;
+
     /**
      * \throws Exception
+     * Just init the target, dont populate store or pool.
+     * If \c doRebuild_r is \c true, an already existing
+     * database is rebuilt (rpm --rebuilddb ).
      */
-    void initTarget(const Pathname & root);
+    void initializeTarget(const Pathname & root, bool doRebuild_r = false);
 
     /**
      * \throws Exception
      */
     void finishTarget();
 
+
+  public:
+    typedef ZYppCommitResult CommitResult;
+
+    /** Commit changes and transactions.
+     * \param \ref CommitPolicy
+     * \return \ref CommitResult
+     * \throws Exception
+    */
+    ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
+
+    /** Install a source package on the Target.
+     * \throws Exception
+     */
+    void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
+
+    /** Provides a source package on the Target.
+     * \throws Exception
+     */
+    ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
+
+  public:
+    /** */
+    Resolver_Ptr resolver() const;
+    KeyRing_Ptr keyRing() const;
+
+  public:
+    /** Get the path where zypp related plugins store persistent data and caches   */
+    Pathname homePath() const;
+
+    /** Get the path where zypp related plugins store temp data   */
+    Pathname tmpPath() const;
+
+    /** set the home, if you need to change it */
+    void setHomePath( const Pathname & path );
+
   protected:
     /** Dtor */
     virtual ~ZYpp();
@@ -75,6 +147,7 @@ namespace zypp
   private:
     /** Factory */
     friend class ZYppFactory;
+
     /** */
     typedef zypp_detail::ZYppImpl Impl;
     typedef shared_ptr<Impl>      Impl_Ptr;