work for bug 149869
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 10 Feb 2006 10:36:19 +0000 (10:36 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 10 Feb 2006 10:36:19 +0000 (10:36 +0000)
zypp/target/TargetImpl.cc
zypp/target/TargetImpl.h
zypp/target/store/PersistentStorage.cc
zypp/target/store/PersistentStorage.h

index f04743a..083b088 100644 (file)
@@ -59,9 +59,6 @@ namespace zypp
     : _root(root_r)
     {
       _rpm.initDatabase(_root);
-#ifndef STORAGE_DISABLED
-      _storage.init(root_r);
-#endif
       MIL << "Initialized target on " << _root << endl;
     }
 
@@ -76,6 +73,20 @@ namespace zypp
       MIL << "Targets closed" << endl;
     }
 
+#ifndef STORAGE_DISABLED
+    bool TargetImpl::isStorageEnabled() const
+    {
+      return _storage.isInitialized();
+    }
+
+    
+    void TargetImpl::enableStorage(const Pathname &root_r)
+    {
+      
+      _storage.init(root_r);
+    }
+#endif
+  
     const ResStore & TargetImpl::resolvables()
     {
       _store.clear();
index 2668913..5988f24 100644 (file)
@@ -77,6 +77,12 @@ namespace zypp
          media > 0 means limit commits to this media */
       void commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r );
 
+#ifndef STORAGE_DISABLED
+      /** enables the storage target */
+      bool isStorageEnabled() const;
+      void enableStorage(const Pathname &root_r);
+#endif
+
       /** Commit ordered changes
          return uncommitted ones (due to error) */
       PoolItemList commit( const PoolItemList & items_r );
index 9d9a1f3..6cd792d 100644 (file)
@@ -58,6 +58,11 @@ void PersistentStorage::init(const Pathname &root)
   d->backend = new XMLFilesBackend(root);
 }
 
+bool PersistentStorage::isInitalized()
+{
+  return ! (d->backend == 0L);
+}
+
 ///////////////////////////////////////////////////////////////////
 //
 //     METHOD NAME : PersistentStorage::~PersistentStorage
index c888f56..228bbc3 100644 (file)
@@ -65,6 +65,12 @@ namespace zypp
        * root path. THIS MUST BE CALLED BEFORE DOING ANY OPERATION
        */
        void init(const Pathname &root);
+
+      /**
+       * true is backend was already initialized
+       */
+       bool isInitalized();
+
       /**
        * Stores a Resolvable in the active backend.
        */
@@ -112,9 +118,9 @@ namespace zypp
     std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
 
     /////////////////////////////////////////////////////////////////
-  } // namespace devel.dmacvicar
+  } // namespace storage
   ///////////////////////////////////////////////////////////////////
   /////////////////////////////////////////////////////////////////
-} // namespace devel
+} // namespace zypp
 ///////////////////////////////////////////////////////////////////
-#endif // DEVEL_DEVEL_DMACVICAR_PERSISTENTSTORAGE_H
+#endif // ZYPP_TARGET_PERSISTENTSTORAGE_H