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( const 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( const 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( const 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 , const std::string &/*description*/
109 virtual void finish(Resolvable::constPtr /*resolvable_ptr*/
111 , const std::string &/*reason*/
115 // progress for probing a source
116 struct ProbeSourceReport : public callback::ReportBase
119 ABORT, // abort and return error
125 NOT_FOUND, // the requested Url was not found
127 INVALID, // th source is invalid
131 virtual void start(const Url &/*url*/) {}
132 virtual void failedProbe( const Url &/*url*/, const std::string &/*type*/ ) {}
133 virtual void successProbe( const Url &/*url*/, const std::string &/*type*/ ) {}
134 virtual void finish(const Url &/*url*/, Error /*error*/, const std::string &/*reason*/ ) {}
136 virtual bool progress(const Url &/*url*/, int /*value*/)
139 virtual Action problem( const Url &/*url*/, Error /*error*/, const std::string &/*description*/ ) { return ABORT; }
142 struct SourceCreateReport : public callback::ReportBase
145 ABORT, // abort and return error
147 IGNORE // skip refresh, ignore failed refresh
152 NOT_FOUND, // the requested Url was not found
155 INVALID, // th source is invali
159 virtual void start( const zypp::Url &/*url*/ ) {}
160 virtual bool progress( int /*value*/ )
163 virtual Action problem(
164 const zypp::Url &/*url*/
166 , const std::string &/*description*/ )
170 const zypp::Url &/*url*/
172 , const std::string &/*reason*/ )
176 struct SourceReport : public callback::ReportBase
179 ABORT, // abort and return error
181 IGNORE // skip refresh, ignore failed refresh
186 NOT_FOUND, // the requested Url was not found
188 INVALID // th source is invalid
191 virtual void start( Source_Ref /*source*/, const std::string &/*task*/ ) {}
192 virtual bool progress( int /*value*/ )
195 virtual Action problem(
196 Source_Ref /*source*/
198 , const std::string &/*description*/ )
202 Source_Ref /*source*/
203 , const std::string &/*task*/
205 , const std::string &/*reason*/ )
210 /////////////////////////////////////////////////////////////////
211 } // namespace source
212 ///////////////////////////////////////////////////////////////////
214 ///////////////////////////////////////////////////////////////////
217 // media change request callback
218 struct MediaChangeReport : public callback::ReportBase
221 ABORT, // abort and return error
223 IGNORE, // ignore this media in future, not available anymore
224 IGNORE_ID, // ignore wrong medium id
225 CHANGE_URL, // change media URL
226 EJECT // eject the medium
231 NOT_FOUND, // the medie not found at all
232 IO, // error accessing the media
233 INVALID, // media is broken
234 WRONG // wrong media, need a different one
237 virtual Action requestMedia(
238 const Source_Ref /*source*/
239 , unsigned /*mediumNr*/
241 , const std::string &/*description*/
245 // progress for downloading a file
246 struct DownloadProgressReport : public callback::ReportBase
249 ABORT, // abort and return error
251 IGNORE // ignore the failure
256 NOT_FOUND, // the requested Url was not found
260 virtual void start( const Url &/*file*/, Pathname /*localfile*/ ) {}
262 virtual bool progress(int /*value*/, const Url &/*file*/)
265 virtual Action problem(
268 , const std::string &/*description*/
274 , const std::string &/*reason*/
278 /////////////////////////////////////////////////////////////////
280 ///////////////////////////////////////////////////////////////////
282 ///////////////////////////////////////////////////////////////////
286 // resolvable Message
287 struct MessageResolvableReport : public callback::ReportBase
290 Message::constPtr /*message*/
294 ///////////////////////////////////////////////////////////////////
298 // progress for installing a resolvable
299 struct InstallResolvableReport : public callback::ReportBase
302 ABORT, // abort and return error
304 IGNORE // ignore the failure
309 NOT_FOUND, // the requested Url was not found
311 INVALID // th resolvable is invalid
314 // the level of RPM pushing
322 Resolvable::constPtr /*resolvable*/
325 virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
328 virtual Action problem(
329 Resolvable::constPtr /*resolvable*/
331 , const std::string &/*description*/
336 Resolvable::constPtr /*resolvable*/
338 , const std::string &/*reason*/
343 // progress for removing a resolvable
344 struct RemoveResolvableReport : public callback::ReportBase
347 ABORT, // abort and return error
349 IGNORE // ignore the failure
354 NOT_FOUND, // the requested Url was not found
356 INVALID // th resolvable is invalid
360 Resolvable::constPtr /*resolvable*/
363 virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
366 virtual Action problem(
367 Resolvable::constPtr /*resolvable*/
369 , const std::string &/*description*/
373 Resolvable::constPtr /*resolvable*/
375 , const std::string &/*reason*/
379 // progress for rebuilding the database
380 struct RebuildDBReport : public callback::ReportBase
383 ABORT, // abort and return error
385 IGNORE // ignore the failure
390 FAILED // failed to rebuild
393 virtual void start(Pathname /*path*/) {}
395 virtual bool progress(int /*value*/, Pathname /*path*/)
398 virtual Action problem(
401 , const std::string &/*description*/
407 , const std::string &/*reason*/
411 // progress for converting the database
412 struct ConvertDBReport : public callback::ReportBase
415 ABORT, // abort and return error
417 IGNORE // ignore the failure
422 FAILED // conversion failed
429 virtual bool progress(int /*value*/, Pathname /*path*/)
432 virtual Action problem(
435 , const std::string &/*description*/
441 , const std::string &/*reason*/
445 // progress for scanning the database
446 struct ScanDBReport : public callback::ReportBase
449 ABORT, // abort and return error
451 IGNORE // ignore the failure
456 FAILED // conversion failed
462 virtual bool progress(int /*value*/)
465 virtual Action problem(
467 , const std::string &/*description*/
472 , const std::string &/*reason*/
476 /////////////////////////////////////////////////////////////////
478 ///////////////////////////////////////////////////////////////////
480 /////////////////////////////////////////////////////////////////
481 } // namespace target
482 ///////////////////////////////////////////////////////////////////
484 /////////////////////////////////////////////////////////////////
486 ///////////////////////////////////////////////////////////////////
488 #endif // ZYPP_ZYPPCALLBACKS_H