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"
19 #include "zypp/Message.h"
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
27 // progress for downloading a resolvable
28 struct DownloadResolvableReport : public callback::ReportBase
31 ABORT, // abort and return error
33 IGNORE, // ignore this resolvable but continue
38 NOT_FOUND, // the requested Url was not found
40 INVALID // the downloaded file is invalid
44 Resolvable::constPtr resolvable_ptr
48 // return false if the download should be aborted right now
49 virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
52 virtual Action problem(
53 Resolvable::constPtr resolvable_ptr
55 , std::string description
58 virtual void finish(Resolvable::constPtr resolvable_ptr
65 // progress for downloading a specific file
66 struct DownloadFileReport : public callback::ReportBase
69 ABORT, // abort and return error
75 NOT_FOUND, // the requested Url was not found
77 INVALID // the downloaded file is invalid
84 virtual bool progress(int value, Url url)
87 virtual Action problem(
90 , std::string description
100 // progress for refreshing a source data
101 struct RefreshSourceReport : public callback::ReportBase
104 ABORT, // abort and return error
106 IGNORE // skip refresh, ignore failed refresh
111 NOT_FOUND, // the requested Url was not found
113 INVALID // th source is invalid
120 virtual bool progress(int value, Source_Ref source)
123 virtual Action problem(
126 , std::string description
136 // progress for creating a source (download and parsing)
137 struct CreateSourceReport : public callback::ReportBase
140 ABORT, // abort and return error
146 NOT_FOUND, // the requested Url was not found
148 INVALID // th source is invalid
151 virtual void startData(
155 virtual void startProbe(Url url) {}
157 virtual void endProbe(Url url) {}
159 virtual bool progressData(int value, Url url)
162 virtual Action problem(
165 , std::string description
168 virtual void finishData(
175 /////////////////////////////////////////////////////////////////
176 } // namespace source
177 ///////////////////////////////////////////////////////////////////
179 ///////////////////////////////////////////////////////////////////
182 // media change request callback
183 struct MediaChangeReport : public callback::ReportBase
186 ABORT, // abort and return error
188 IGNORE, // ignore this media in future, not available anymore
189 IGNORE_ID, // ignore wrong medium id
190 CHANGE_URL, // change media URL
191 EJECT // eject the medium
196 NOT_FOUND, // the medie not found at all
197 IO, // error accessing the media
198 INVALID, // media is broken
199 WRONG // wrong media, need a different one
202 virtual Action requestMedia(
203 const Source_Ref source
206 , std::string description
210 // progress for downloading a file
211 struct DownloadProgressReport : public callback::ReportBase
214 ABORT, // abort and return error
216 IGNORE // ignore the failure
221 NOT_FOUND, // the requested Url was not found
225 virtual void start( Url file, Pathname localfile ) {}
227 virtual bool progress(int value, Url file)
230 virtual Action problem(
233 , std::string description
243 /////////////////////////////////////////////////////////////////
245 ///////////////////////////////////////////////////////////////////
247 ///////////////////////////////////////////////////////////////////
251 // resolvable Message
252 struct MessageResolvableReport : public callback::ReportBase
255 Message::constPtr message
259 ///////////////////////////////////////////////////////////////////
263 // progress for installing a resolvable
264 struct InstallResolvableReport : public callback::ReportBase
267 ABORT, // abort and return error
269 IGNORE // ignore the failure
274 NOT_FOUND, // the requested Url was not found
276 INVALID // th resolvable is invalid
279 // the level of RPM pushing
287 Resolvable::constPtr resolvable
290 virtual bool progress(int value, Resolvable::constPtr resolvable)
293 virtual Action problem(
294 Resolvable::constPtr resolvable
296 , std::string description
301 Resolvable::constPtr resolvable
308 // progress for removing a resolvable
309 struct RemoveResolvableReport : public callback::ReportBase
312 ABORT, // abort and return error
314 IGNORE // ignore the failure
319 NOT_FOUND, // the requested Url was not found
321 INVALID // th resolvable is invalid
325 Resolvable::constPtr resolvable
328 virtual bool progress(int value, Resolvable::constPtr resolvable)
331 virtual Action problem(
332 Resolvable::constPtr resolvable
334 , std::string description
338 Resolvable::constPtr resolvable
344 // progress for rebuilding the database
345 struct RebuildDBReport : public callback::ReportBase
348 ABORT, // abort and return error
350 IGNORE // ignore the failure
355 FAILED // failed to rebuild
358 virtual void start(Pathname path) {}
360 virtual bool progress(int value, Pathname path)
363 virtual Action problem(
366 , std::string description
376 // progress for converting the database
377 struct ConvertDBReport : public callback::ReportBase
380 ABORT, // abort and return error
382 IGNORE // ignore the failure
387 FAILED // conversion failed
394 virtual bool progress(int value, Pathname path)
397 virtual Action problem(
400 , std::string description
410 // progress for scanning the database
411 struct ScanDBReport : public callback::ReportBase
414 ABORT, // abort and return error
416 IGNORE // ignore the failure
421 FAILED // conversion failed
427 virtual bool progress(int value)
430 virtual Action problem(
432 , std::string description
441 /////////////////////////////////////////////////////////////////
443 ///////////////////////////////////////////////////////////////////
445 /////////////////////////////////////////////////////////////////
446 } // namespace target
447 ///////////////////////////////////////////////////////////////////
449 /////////////////////////////////////////////////////////////////
451 ///////////////////////////////////////////////////////////////////
453 #endif // ZYPP_ZYPPCALLBACKS_H