f572e3cefe5720af8f47a97a82cdefddd2dd3701
[platform/upstream/libzypp.git] / zypp / target / store / Backend.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/target/store/Backend.h
10 *
11 */
12 #ifndef ZYPP_STORAGE_BACKEND_H
13 #define ZYPP_STORAGE_BACKEND_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/PtrTypes.h"
18 #include <zypp/Pathname.h>
19 #include <zypp/Patch.h>
20
21 #include <zypp/target/store/PersistentStorage.h>
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
27 namespace storage
28 { /////////////////////////////////////////////////////////////////
29
30 ///////////////////////////////////////////////////////////////////
31 //
32 //      CLASS NAME : Backend
33 //
34 /**
35 * This class represents a storage backend implementation
36 */
37 class Backend
38 {
39   friend std::ostream & operator<<( std::ostream & str, const Backend & obj );
40 public:
41   /** root is the system root path */
42   Backend(const Pathname &root);
43   /** Dtor */
44   virtual ~Backend();
45   virtual void doTest() = 0;
46
47   /**
48   * is the storage backend initialized
49   */
50   virtual bool isBackendInitialized() const = 0;
51   /**
52   * initialize the storage backend
53   */
54   virtual void initBackend() = 0;
55
56   /**
57   * Stores a Resolvable in the active backend.
58   */
59   virtual void storeObject( Resolvable::constPtr resolvable )  = 0;
60   /**
61   * Deletes a Resolvable from the active backend.
62   */
63   virtual void deleteObject( Resolvable::Ptr resolvable ) = 0;
64
65   /**
66   * Query for installed Resolvables.
67   */
68   virtual std::list<Resolvable::Ptr> storedObjects() const = 0;
69   /**
70   * Query for installed Resolvables of a certain kind
71   */
72   virtual std::list<Resolvable::Ptr> storedObjects(const Resolvable::Kind) const = 0;
73   /**
74   * Query for installed Resolvables of a certain kind by name
75   * \a partial_match allows for text search.
76   */
77   virtual std::list<Resolvable::Ptr> storedObjects(const Resolvable::Kind, const std::string & name, bool partial_match = false) const = 0;
78
79
80   /////////////////////////////////////////////////////////
81   // SOURCES API
82   ////////////////////////////////////////////////////////
83   /**
84     * Query for installed Sources
85     */
86   virtual std::list<PersistentStorage::SourceData> storedSources() const = 0;
87   /**
88     * Query for installed Sources
89     */
90   virtual void storeSource(const PersistentStorage::SourceData &data) = 0;
91   /**
92     * Query for installed Sources
93     */
94   virtual void deleteSource(const std::string &alias) = 0;
95
96 private:
97   /** Pointer to implementation */
98   class Private;
99   Private *d;
100 };
101 ///////////////////////////////////////////////////////////////////
102
103 /** \relates Backend Stream output */
104 std::ostream & operator<<( std::ostream & str, const Backend & obj );
105
106 /////////////////////////////////////////////////////////////////
107 } // namespace storage
108 ///////////////////////////////////////////////////////////////////
109 /////////////////////////////////////////////////////////////////
110 } // namespace zypp
111 ///////////////////////////////////////////////////////////////////
112 #endif // DEVEL_DEVEL_DMACVICAR_BACKEND_H