1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZYppCallbacks.h
12 #ifndef ZYPP_ZYPPCALLBACKS_H
13 #define ZYPP_ZYPPCALLBACKS_H
15 #include "zypp/Callback.h"
16 #include "zypp/Resolvable.h"
17 #include "zypp/Source.h"
18 #include "zypp/Pathname.h"
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
26 // progress for downloading a resolvable
27 struct DownloadResolvableReport : public callback::ReportBase
30 ABORT, // abort and return error
36 NOT_FOUND, // the requested Url was not found
38 INVALID // the downloaded file is invalid
42 Resolvable::Ptr resolvable_ptr
46 // return false if the download should be aborted right now
47 virtual bool progress(int value, Resolvable::Ptr resolvable_ptr)
50 virtual Action problem(
51 Resolvable::Ptr resolvable_ptr
53 , std::string description
56 virtual void finish(Resolvable::Ptr resolvable_ptr
63 // progress for downloading a specific file
64 struct DownloadFileReport : public callback::ReportBase
67 ABORT, // abort and return error
73 NOT_FOUND, // the requested Url was not found
75 INVALID // the downloaded file is invalid
82 virtual bool progress(int value, Url url)
85 virtual Action problem(
88 , std::string description
98 // progress for refreshing a source data
99 struct RefreshSourceReport : public callback::ReportBase
102 ABORT, // abort and return error
104 IGNORE // skip refresh, ignore failed refresh
109 NOT_FOUND, // the requested Url was not found
111 INVALID // th source is invalid
118 virtual bool progress(int value, Source_Ref source)
121 virtual Action problem(
124 , std::string description
134 // progress for creating a source (download and parsing)
135 struct CreateSourceReport : public callback::ReportBase
138 ABORT, // abort and return error
144 NOT_FOUND, // the requested Url was not found
146 INVALID // th source is invalid
149 virtual void startData(
153 virtual void startProbe(Url url) {}
155 virtual void endProbe(Url url) {}
157 virtual bool progressData(int value, Url url)
160 virtual Action problem(
163 , std::string description
166 virtual void finishData(
173 /////////////////////////////////////////////////////////////////
174 } // namespace source
175 ///////////////////////////////////////////////////////////////////
177 ///////////////////////////////////////////////////////////////////
180 // media change request callback
181 struct MediaChangeReport : public callback::ReportBase
184 ABORT, // abort and return error
186 IGNORE, // ignore this media in future, not available anymore
187 IGNORE_ID, // ignore wrong medium id
188 CHANGE_URL, // change media URL
189 EJECT // eject the medium
194 NOT_FOUND, // the medie not found at all
195 IO, // error accessing the media
196 INVALID, // media is broken
197 WRONG // wrong media, need a different one
200 virtual Action requestMedia(
201 const Source_Ref source
204 , std::string description
208 /////////////////////////////////////////////////////////////////
210 ///////////////////////////////////////////////////////////////////
212 ///////////////////////////////////////////////////////////////////
216 ///////////////////////////////////////////////////////////////////
220 // progress for installing a resolvable
221 struct InstallResolvableReport : public callback::ReportBase
224 ABORT, // abort and return error
226 IGNORE // ignore the failure
231 NOT_FOUND, // the requested Url was not found
233 INVALID // th resolvable is invalid
236 // the level of RPM pushing
244 Resolvable::constPtr resolvable
247 virtual bool progress(int value, Resolvable::constPtr resolvable)
250 virtual Action problem(
251 Resolvable::constPtr resolvable
253 , std::string description
258 Resolvable::constPtr resolvable
265 // progress for removing a resolvable
266 struct RemoveResolvableReport : public callback::ReportBase
269 ABORT, // abort and return error
271 IGNORE // ignore the failure
276 NOT_FOUND, // the requested Url was not found
278 INVALID // th resolvable is invalid
282 Resolvable::Ptr resolvable
285 virtual bool progress(int value, Resolvable::Ptr resolvable)
288 virtual Action problem(
289 Resolvable::Ptr resolvable
291 , std::string description
295 Resolvable::Ptr resolvable
301 // progress for rebuilding the database
302 struct RebuildDBReport : public callback::ReportBase
305 ABORT, // abort and return error
307 IGNORE // ignore the failure
312 NOT_FOUND, // the requested Url was not found
314 INVALID // th resolvable is invalid
321 virtual bool progress(int value, Pathname path)
324 virtual Action problem(
327 , std::string description
337 // progress for converting the database
338 struct ConvertDBReport : public callback::ReportBase
341 ABORT, // abort and return error
343 IGNORE // ignore the failure
348 NOT_FOUND, // the requested Url was not found
350 INVALID // th resolvable is invalid
357 virtual bool progress(int value, Pathname path)
360 virtual Action problem(
363 , std::string description
373 /////////////////////////////////////////////////////////////////
375 ///////////////////////////////////////////////////////////////////
377 /////////////////////////////////////////////////////////////////
378 } // namespace target
379 ///////////////////////////////////////////////////////////////////
381 /////////////////////////////////////////////////////////////////
383 ///////////////////////////////////////////////////////////////////
385 #endif // ZYPP_ZYPPCALLBACKS_H