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 )
63 virtual void finishDeltaDownload()
67 // - local path of downloaded delta
68 // - aplpy is not interruptable
69 // - problems are just informal
70 virtual void startDeltaApply( const Pathname & filename )
73 virtual void progressDeltaApply( int value )
76 virtual void problemDeltaApply( std::string description )
79 virtual void finishDeltaApply()
82 // Dowmload patch rpm:
83 // - path below url reported on start()
84 // - expected download size (0 if unknown)
85 // - download is interruptable
86 virtual void startPatchDownload( const Pathname & filename, const ByteCount & downloadsize )
89 virtual bool progressPatchDownload( int value )
92 virtual void problemPatchDownload( std::string description )
95 virtual void finishPatchDownload()
99 // return false if the download should be aborted right now
100 virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
103 virtual Action problem(
104 Resolvable::constPtr resolvable_ptr
106 , std::string description
109 virtual void finish(Resolvable::constPtr resolvable_ptr
116 // progress for downloading a specific file
117 struct DownloadFileReport : public callback::ReportBase
120 ABORT, // abort and return error
126 NOT_FOUND, // the requested Url was not found
128 INVALID // the downloaded file is invalid
135 virtual bool progress(int value, Url url)
138 virtual Action problem(
141 , std::string description
151 // progress for refreshing a source data
152 struct RefreshSourceReport : public callback::ReportBase
155 ABORT, // abort and return error
157 IGNORE // skip refresh, ignore failed refresh
162 NOT_FOUND, // the requested Url was not found
164 INVALID // th source is invalid
171 virtual bool progress(int value, Source_Ref source)
174 virtual Action problem(
177 , std::string description
188 struct CreateSourceReport : public callback::ReportBase
191 ABORT, // abort and return error
197 NOT_FOUND, // the requested Url was not found
199 INVALID // th source is invalid
202 virtual void startData(
206 virtual void startProbe(Url url) {}
208 virtual void endProbe(Url url) {}
210 virtual bool progressData(int value, Url url)
213 virtual Action problem(
216 , std::string description
219 virtual void finishData(
226 // progress for probing a source
227 struct ProbeSourceReport : public callback::ReportBase
230 ABORT, // abort and return error
236 NOT_FOUND, // the requested Url was not found
238 INVALID // th source is invalid
241 virtual void start(const Url &url) {}
242 virtual void failedProbe( const Url &url, const std::string &type ) {}
243 virtual void successProbe( const Url &url, const std::string &type ) {}
244 virtual void finish(const Url &url, Error error, std::string reason ) {}
246 virtual bool progress(const Url &url, int value)
249 virtual Action problem( const Url &url, Error error, std::string description ) { return ABORT; }
252 // progress for refreshing a source data
253 struct SourceProcessReport : public callback::ReportBase
256 ABORT, // abort and return error
258 IGNORE // skip refresh, ignore failed refresh
263 NOT_FOUND, // the requested Url was not found
265 INVALID // th source is invalid
268 virtual void start( Source_Ref source ) {}
269 virtual bool progress(int value, Source_Ref source)
272 virtual Action problem(
275 , std::string description )
281 , std::string reason )
286 /////////////////////////////////////////////////////////////////
287 } // namespace source
288 ///////////////////////////////////////////////////////////////////
290 ///////////////////////////////////////////////////////////////////
293 // media change request callback
294 struct MediaChangeReport : public callback::ReportBase
297 ABORT, // abort and return error
299 IGNORE, // ignore this media in future, not available anymore
300 IGNORE_ID, // ignore wrong medium id
301 CHANGE_URL, // change media URL
302 EJECT // eject the medium
307 NOT_FOUND, // the medie not found at all
308 IO, // error accessing the media
309 INVALID, // media is broken
310 WRONG // wrong media, need a different one
313 virtual Action requestMedia(
314 const Source_Ref source
317 , std::string description
321 // progress for downloading a file
322 struct DownloadProgressReport : public callback::ReportBase
325 ABORT, // abort and return error
327 IGNORE // ignore the failure
332 NOT_FOUND, // the requested Url was not found
336 virtual void start( Url file, Pathname localfile ) {}
338 virtual bool progress(int value, Url file)
341 virtual Action problem(
344 , std::string description
354 /////////////////////////////////////////////////////////////////
356 ///////////////////////////////////////////////////////////////////
358 ///////////////////////////////////////////////////////////////////
362 // resolvable Message
363 struct MessageResolvableReport : public callback::ReportBase
366 Message::constPtr message
370 ///////////////////////////////////////////////////////////////////
374 // progress for installing a resolvable
375 struct InstallResolvableReport : public callback::ReportBase
378 ABORT, // abort and return error
380 IGNORE // ignore the failure
385 NOT_FOUND, // the requested Url was not found
387 INVALID // th resolvable is invalid
390 // the level of RPM pushing
398 Resolvable::constPtr resolvable
401 virtual bool progress(int value, Resolvable::constPtr resolvable)
404 virtual Action problem(
405 Resolvable::constPtr resolvable
407 , std::string description
412 Resolvable::constPtr resolvable
419 // progress for removing a resolvable
420 struct RemoveResolvableReport : public callback::ReportBase
423 ABORT, // abort and return error
425 IGNORE // ignore the failure
430 NOT_FOUND, // the requested Url was not found
432 INVALID // th resolvable is invalid
436 Resolvable::constPtr resolvable
439 virtual bool progress(int value, Resolvable::constPtr resolvable)
442 virtual Action problem(
443 Resolvable::constPtr resolvable
445 , std::string description
449 Resolvable::constPtr resolvable
455 // progress for rebuilding the database
456 struct RebuildDBReport : public callback::ReportBase
459 ABORT, // abort and return error
461 IGNORE // ignore the failure
466 FAILED // failed to rebuild
469 virtual void start(Pathname path) {}
471 virtual bool progress(int value, Pathname path)
474 virtual Action problem(
477 , std::string description
487 // progress for converting the database
488 struct ConvertDBReport : public callback::ReportBase
491 ABORT, // abort and return error
493 IGNORE // ignore the failure
498 FAILED // conversion failed
505 virtual bool progress(int value, Pathname path)
508 virtual Action problem(
511 , std::string description
521 // progress for scanning the database
522 struct ScanDBReport : public callback::ReportBase
525 ABORT, // abort and return error
527 IGNORE // ignore the failure
532 FAILED // conversion failed
538 virtual bool progress(int value)
541 virtual Action problem(
543 , std::string description
552 /////////////////////////////////////////////////////////////////
554 ///////////////////////////////////////////////////////////////////
556 /////////////////////////////////////////////////////////////////
557 } // namespace target
558 ///////////////////////////////////////////////////////////////////
560 /////////////////////////////////////////////////////////////////
562 ///////////////////////////////////////////////////////////////////
564 #endif // ZYPP_ZYPPCALLBACKS_H