1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file devel/devel.dmacvicar/PersistentStorage.h
12 #ifndef ZYPP_TARGET_PERSISTENTSTORAGE_H
13 #define ZYPP_TARGET_PERSISTENTSTORAGE_H
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include <zypp/Pathname.h>
21 #include <zypp/Patch.h>
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
29 ///////////////////////////////////////////////////////////////////
31 // CLASS NAME : PersistentStorage
34 class PersistentStorage : public base::ReferenceCounted, private base::NonCopyable
36 friend std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
37 typedef intrusive_ptr<PersistentStorage> Ptr;
38 typedef intrusive_ptr<const PersistentStorage> constPtr;
56 std::string product_dir;
64 * Initializes the Storage when the system is located in some
65 * root path. THIS MUST BE CALLED BEFORE DOING ANY OPERATION
67 void init(const Pathname &root);
70 * true is backend was already initialized
75 * Stores a Resolvable in the active backend.
77 void storeObject( ResObject::constPtr resolvable );
79 * Deletes a Resolvable from the active backend.
81 void deleteObject( ResObject::constPtr resolvable );
83 * Query for installed Resolvables.
85 std::list<ResObject::Ptr> storedObjects() const;
87 * Query for installed Resolvables of a certain kind.
89 std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind) const;
91 * Query for installed Resolvables of a certain kind by name
92 * \a partial_match allows for text search.
94 std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind, const std::string & name, bool partial_match = false) const;
96 /////////////////////////////////////////////////////////
98 ////////////////////////////////////////////////////////
100 * Query for installed Sources
102 std::list<SourceData> storedSources() const;
104 * Query for installed Sources
106 void storeSource(const SourceData &data);
108 * Query for installed Sources
110 void deleteSource(const std::string &alias);
116 ///////////////////////////////////////////////////////////////////
117 /** \relates PersistentStorage Stream output */
118 std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
120 /////////////////////////////////////////////////////////////////
121 } // namespace storage
122 ///////////////////////////////////////////////////////////////////
123 /////////////////////////////////////////////////////////////////
125 ///////////////////////////////////////////////////////////////////
126 #endif // ZYPP_TARGET_PERSISTENTSTORAGE_H