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
49 // Dowmload delta rpm:
50 // - path below url reported on start()
51 // - expected download size (0 if unknown)
52 // - download is interruptable
53 // - problems are just informal
54 virtual void startDeltaDownload( const Pathname & filename, const ByteCount & downloadsize )
57 virtual bool progressDeltaDownload( int value )
60 virtual void problemDeltaDownload( std::string description )
64 // - local path of downloaded delta
65 // - aplpy is not interruptable
66 // - problems are just informal
67 virtual void startDeltaApply( const Pathname & filename )
70 virtual void progressDeltaApply( int value )
73 virtual void problemDeltaApply( std::string description )
76 // Dowmload patch rpm:
77 // - path below url reported on start()
78 // - expected download size (0 if unknown)
79 // - download is interruptable
80 virtual void startPatchDownload( const Pathname & filename, const ByteCount & downloadsize )
83 virtual bool progressPatchDownload( int value )
86 virtual void problemPatchDownload( std::string description )
90 // return false if the download should be aborted right now
91 virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
94 virtual Action problem(
95 Resolvable::constPtr resolvable_ptr
97 , std::string description
100 virtual void finish(Resolvable::constPtr resolvable_ptr
107 // progress for downloading a specific file
108 struct DownloadFileReport : public callback::ReportBase
111 ABORT, // abort and return error
117 NOT_FOUND, // the requested Url was not found
119 INVALID // the downloaded file is invalid
126 virtual bool progress(int value, Url url)
129 virtual Action problem(
132 , std::string description
142 // progress for refreshing a source data
143 struct RefreshSourceReport : public callback::ReportBase
146 ABORT, // abort and return error
148 IGNORE // skip refresh, ignore failed refresh
153 NOT_FOUND, // the requested Url was not found
155 INVALID // th source is invalid
162 virtual bool progress(int value, Source_Ref source)
165 virtual Action problem(
168 , std::string description
178 // progress for creating a source (download and parsing)
179 struct CreateSourceReport : public callback::ReportBase
182 ABORT, // abort and return error
188 NOT_FOUND, // the requested Url was not found
190 INVALID // th source is invalid
193 virtual void startData(
197 virtual void startProbe(Url url) {}
199 virtual void endProbe(Url url) {}
201 virtual bool progressData(int value, Url url)
204 virtual Action problem(
207 , std::string description
210 virtual void finishData(
217 /////////////////////////////////////////////////////////////////
218 } // namespace source
219 ///////////////////////////////////////////////////////////////////
221 ///////////////////////////////////////////////////////////////////
224 // media change request callback
225 struct MediaChangeReport : public callback::ReportBase
228 ABORT, // abort and return error
230 IGNORE, // ignore this media in future, not available anymore
231 IGNORE_ID, // ignore wrong medium id
232 CHANGE_URL, // change media URL
233 EJECT // eject the medium
238 NOT_FOUND, // the medie not found at all
239 IO, // error accessing the media
240 INVALID, // media is broken
241 WRONG // wrong media, need a different one
244 virtual Action requestMedia(
245 const Source_Ref source
248 , std::string description
252 // progress for downloading a file
253 struct DownloadProgressReport : public callback::ReportBase
256 ABORT, // abort and return error
258 IGNORE // ignore the failure
263 NOT_FOUND, // the requested Url was not found
267 virtual void start( Url file, Pathname localfile ) {}
269 virtual bool progress(int value, Url file)
272 virtual Action problem(
275 , std::string description
285 /////////////////////////////////////////////////////////////////
287 ///////////////////////////////////////////////////////////////////
289 ///////////////////////////////////////////////////////////////////
293 // resolvable Message
294 struct MessageResolvableReport : public callback::ReportBase
297 Message::constPtr message
301 ///////////////////////////////////////////////////////////////////
305 // progress for installing a resolvable
306 struct InstallResolvableReport : public callback::ReportBase
309 ABORT, // abort and return error
311 IGNORE // ignore the failure
316 NOT_FOUND, // the requested Url was not found
318 INVALID // th resolvable is invalid
321 // the level of RPM pushing
329 Resolvable::constPtr resolvable
332 virtual bool progress(int value, Resolvable::constPtr resolvable)
335 virtual Action problem(
336 Resolvable::constPtr resolvable
338 , std::string description
343 Resolvable::constPtr resolvable
350 // progress for removing a resolvable
351 struct RemoveResolvableReport : public callback::ReportBase
354 ABORT, // abort and return error
356 IGNORE // ignore the failure
361 NOT_FOUND, // the requested Url was not found
363 INVALID // th resolvable is invalid
367 Resolvable::constPtr resolvable
370 virtual bool progress(int value, Resolvable::constPtr resolvable)
373 virtual Action problem(
374 Resolvable::constPtr resolvable
376 , std::string description
380 Resolvable::constPtr resolvable
386 // progress for rebuilding the database
387 struct RebuildDBReport : public callback::ReportBase
390 ABORT, // abort and return error
392 IGNORE // ignore the failure
397 FAILED // failed to rebuild
400 virtual void start(Pathname path) {}
402 virtual bool progress(int value, Pathname path)
405 virtual Action problem(
408 , std::string description
418 // progress for converting the database
419 struct ConvertDBReport : public callback::ReportBase
422 ABORT, // abort and return error
424 IGNORE // ignore the failure
429 FAILED // conversion failed
436 virtual bool progress(int value, Pathname path)
439 virtual Action problem(
442 , std::string description
452 // progress for scanning the database
453 struct ScanDBReport : public callback::ReportBase
456 ABORT, // abort and return error
458 IGNORE // ignore the failure
463 FAILED // conversion failed
469 virtual bool progress(int value)
472 virtual Action problem(
474 , std::string description
483 /////////////////////////////////////////////////////////////////
485 ///////////////////////////////////////////////////////////////////
487 /////////////////////////////////////////////////////////////////
488 } // namespace target
489 ///////////////////////////////////////////////////////////////////
491 /////////////////////////////////////////////////////////////////
493 ///////////////////////////////////////////////////////////////////
495 #endif // ZYPP_ZYPPCALLBACKS_H