00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_ZYPPCALLBACKS_H
00013 #define ZYPP_ZYPPCALLBACKS_H
00014
00015 #include "zypp/Callback.h"
00016 #include "zypp/Resolvable.h"
00017 #include "zypp/Source.h"
00018 #include "zypp/Pathname.h"
00019 #include "zypp/Message.h"
00020 #include "zypp/Url.h"
00021
00023 namespace zypp
00024 {
00025 namespace source
00026 {
00027
00028 struct DownloadResolvableReport : public callback::ReportBase
00029 {
00030 enum Action {
00031 ABORT,
00032 RETRY,
00033 IGNORE,
00034 };
00035
00036 enum Error {
00037 NO_ERROR,
00038 NOT_FOUND,
00039 IO,
00040 INVALID
00041 };
00042
00043 virtual void start(
00044 Resolvable::constPtr
00045 , const Url &
00046 ) {}
00047
00048
00049
00050
00051
00052
00053
00054 virtual void startDeltaDownload( const Pathname & , const ByteCount & )
00055 {}
00056
00057 virtual bool progressDeltaDownload( int )
00058 { return true; }
00059
00060 virtual void problemDeltaDownload( const std::string & )
00061 {}
00062
00063 virtual void finishDeltaDownload()
00064 {}
00065
00066
00067
00068
00069
00070 virtual void startDeltaApply( const Pathname & )
00071 {}
00072
00073 virtual void progressDeltaApply( int )
00074 {}
00075
00076 virtual void problemDeltaApply( const std::string & )
00077 {}
00078
00079 virtual void finishDeltaApply()
00080 {}
00081
00082
00083
00084
00085
00086 virtual void startPatchDownload( const Pathname & , const ByteCount & )
00087 {}
00088
00089 virtual bool progressPatchDownload( int )
00090 { return true; }
00091
00092 virtual void problemPatchDownload( const std::string & )
00093 {}
00094
00095 virtual void finishPatchDownload()
00096 {}
00097
00098
00099
00100 virtual bool progress(int , Resolvable::constPtr )
00101 { return true; }
00102
00103 virtual Action problem(
00104 Resolvable::constPtr
00105 , Error
00106 , const std::string &
00107 ) { return ABORT; }
00108
00109 virtual void finish(Resolvable::constPtr
00110 , Error
00111 , const std::string &
00112 ) {}
00113 };
00114
00115
00116 struct ProbeSourceReport : public callback::ReportBase
00117 {
00118 enum Action {
00119 ABORT,
00120 RETRY
00121 };
00122
00123 enum Error {
00124 NO_ERROR,
00125 NOT_FOUND,
00126 IO,
00127 INVALID,
00128 UNKNOWN
00129 };
00130
00131 virtual void start(const Url &) {}
00132 virtual void failedProbe( const Url &, const std::string & ) {}
00133 virtual void successProbe( const Url &, const std::string & ) {}
00134 virtual void finish(const Url &, Error , const std::string & ) {}
00135
00136 virtual bool progress(const Url &, int )
00137 { return true; }
00138
00139 virtual Action problem( const Url &, Error , const std::string & ) { return ABORT; }
00140 };
00141
00142 struct SourceCreateReport : public callback::ReportBase
00143 {
00144 enum Action {
00145 ABORT,
00146 RETRY,
00147 IGNORE
00148 };
00149
00150 enum Error {
00151 NO_ERROR,
00152 NOT_FOUND,
00153 IO,
00154 REJECTED,
00155 INVALID,
00156 UNKNOWN
00157 };
00158
00159 virtual void start( const zypp::Url & ) {}
00160 virtual bool progress( int )
00161 { return true; }
00162
00163 virtual Action problem(
00164 const zypp::Url &
00165 , Error
00166 , const std::string & )
00167 { return ABORT; }
00168
00169 virtual void finish(
00170 const zypp::Url &
00171 , Error
00172 , const std::string & )
00173 {}
00174 };
00175
00176 struct SourceReport : public callback::ReportBase
00177 {
00178 enum Action {
00179 ABORT,
00180 RETRY,
00181 IGNORE
00182 };
00183
00184 enum Error {
00185 NO_ERROR,
00186 NOT_FOUND,
00187 IO,
00188 INVALID
00189 };
00190
00191 virtual void start( Source_Ref , const std::string & ) {}
00192 virtual bool progress( int )
00193 { return true; }
00194
00195 virtual Action problem(
00196 Source_Ref
00197 , Error
00198 , const std::string & )
00199 { return ABORT; }
00200
00201 virtual void finish(
00202 Source_Ref
00203 , const std::string &
00204 , Error
00205 , const std::string & )
00206 {}
00207 };
00208
00209
00211 }
00213
00215 namespace media
00216 {
00217
00218 struct MediaChangeReport : public callback::ReportBase
00219 {
00220 enum Action {
00221 ABORT,
00222 RETRY,
00223 IGNORE,
00224 IGNORE_ID,
00225 CHANGE_URL,
00226 EJECT
00227 };
00228
00229 enum Error {
00230 NO_ERROR,
00231 NOT_FOUND,
00232 IO,
00233 INVALID,
00234 WRONG
00235 };
00236
00237 virtual Action requestMedia(
00238 Source_Ref
00239 , unsigned
00240 , Error
00241 , const std::string &
00242 ) { return ABORT; }
00243 };
00244
00245
00246 struct DownloadProgressReport : public callback::ReportBase
00247 {
00248 enum Action {
00249 ABORT,
00250 RETRY,
00251 IGNORE
00252 };
00253
00254 enum Error {
00255 NO_ERROR,
00256 NOT_FOUND,
00257 IO
00258 };
00259
00260 virtual void start( const Url &, Pathname ) {}
00261
00262 virtual bool progress(int , const Url &)
00263 { return true; }
00264
00265 virtual Action problem(
00266 const Url &
00267 , Error
00268 , const std::string &
00269 ) { return ABORT; }
00270
00271 virtual void finish(
00272 const Url &
00273 , Error
00274 , const std::string &
00275 ) {}
00276 };
00277
00279 }
00281
00283 namespace target
00284 {
00285
00286
00287 struct MessageResolvableReport : public callback::ReportBase
00288 {
00289 virtual void show(
00290 Message::constPtr
00291 ) {}
00292 };
00293
00294
00295 struct ScriptResolvableReport : public callback::ReportBase
00296 {
00297 enum Task { DO, UNDO };
00298 enum Notify { OUTPUT, PING };
00299
00301 virtual void start( const Resolvable::constPtr & ,
00302 const Pathname & ,
00303 Task )
00304 {}
00309 virtual bool progress( Notify , const std::string & = std::string() )
00310 { return true; }
00312 virtual void problem( const std::string & )
00313 {}
00315 virtual void finish()
00316 {}
00317 };
00318
00320 namespace rpm
00321 {
00322
00323
00324 struct InstallResolvableReport : public callback::ReportBase
00325 {
00326 enum Action {
00327 ABORT,
00328 RETRY,
00329 IGNORE
00330 };
00331
00332 enum Error {
00333 NO_ERROR,
00334 NOT_FOUND,
00335 IO,
00336 INVALID
00337 };
00338
00339
00340 enum RpmLevel {
00341 RPM,
00342 RPM_NODEPS,
00343 RPM_NODEPS_FORCE
00344 };
00345
00346 virtual void start(
00347 Resolvable::constPtr
00348 ) {}
00349
00350 virtual bool progress(int , Resolvable::constPtr )
00351 { return true; }
00352
00353 virtual Action problem(
00354 Resolvable::constPtr
00355 , Error
00356 , const std::string &
00357 , RpmLevel
00358 ) { return ABORT; }
00359
00360 virtual void finish(
00361 Resolvable::constPtr
00362 , Error
00363 , const std::string &
00364 , RpmLevel
00365 ) {}
00366 };
00367
00368
00369 struct RemoveResolvableReport : public callback::ReportBase
00370 {
00371 enum Action {
00372 ABORT,
00373 RETRY,
00374 IGNORE
00375 };
00376
00377 enum Error {
00378 NO_ERROR,
00379 NOT_FOUND,
00380 IO,
00381 INVALID
00382 };
00383
00384 virtual void start(
00385 Resolvable::constPtr
00386 ) {}
00387
00388 virtual bool progress(int , Resolvable::constPtr )
00389 { return true; }
00390
00391 virtual Action problem(
00392 Resolvable::constPtr
00393 , Error
00394 , const std::string &
00395 ) { return ABORT; }
00396
00397 virtual void finish(
00398 Resolvable::constPtr
00399 , Error
00400 , const std::string &
00401 ) {}
00402 };
00403
00404
00405 struct RebuildDBReport : public callback::ReportBase
00406 {
00407 enum Action {
00408 ABORT,
00409 RETRY,
00410 IGNORE
00411 };
00412
00413 enum Error {
00414 NO_ERROR,
00415 FAILED
00416 };
00417
00418 virtual void start(Pathname ) {}
00419
00420 virtual bool progress(int , Pathname )
00421 { return true; }
00422
00423 virtual Action problem(
00424 Pathname
00425 , Error
00426 , const std::string &
00427 ) { return ABORT; }
00428
00429 virtual void finish(
00430 Pathname
00431 , Error
00432 , const std::string &
00433 ) {}
00434 };
00435
00436
00437 struct ConvertDBReport : public callback::ReportBase
00438 {
00439 enum Action {
00440 ABORT,
00441 RETRY,
00442 IGNORE
00443 };
00444
00445 enum Error {
00446 NO_ERROR,
00447 FAILED
00448 };
00449
00450 virtual void start(
00451 Pathname
00452 ) {}
00453
00454 virtual bool progress(int , Pathname )
00455 { return true; }
00456
00457 virtual Action problem(
00458 Pathname
00459 , Error
00460 , const std::string &
00461 ) { return ABORT; }
00462
00463 virtual void finish(
00464 Pathname
00465 , Error
00466 , const std::string &
00467 ) {}
00468 };
00469
00470
00471 struct ScanDBReport : public callback::ReportBase
00472 {
00473 enum Action {
00474 ABORT,
00475 RETRY,
00476 IGNORE
00477 };
00478
00479 enum Error {
00480 NO_ERROR,
00481 FAILED
00482 };
00483
00484 virtual void start(
00485 ) {}
00486
00487 virtual bool progress(int )
00488 { return true; }
00489
00490 virtual Action problem(
00491 Error
00492 , const std::string &
00493 ) { return ABORT; }
00494
00495 virtual void finish(
00496 Error
00497 , const std::string &
00498 ) {}
00499 };
00500
00502 }
00504
00506 }
00508
00510 }
00512
00513 #endif // ZYPP_ZYPPCALLBACKS_H