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 };
00034
00035 enum Error {
00036 NO_ERROR,
00037 NOT_FOUND,
00038 IO,
00039 INVALID
00040 };
00041
00042 virtual void start(
00043 Resolvable::constPtr resolvable_ptr
00044 , Url url
00045 ) {}
00046
00047
00048 virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
00049 { return true; }
00050
00051 virtual Action problem(
00052 Resolvable::constPtr resolvable_ptr
00053 , Error error
00054 , std::string description
00055 ) { return ABORT; }
00056
00057 virtual void finish(Resolvable::constPtr resolvable_ptr
00058 , Error error
00059 , std::string reason
00060 ) {}
00061 };
00062
00063
00064
00065 struct DownloadFileReport : public callback::ReportBase
00066 {
00067 enum Action {
00068 ABORT,
00069 RETRY
00070 };
00071
00072 enum Error {
00073 NO_ERROR,
00074 NOT_FOUND,
00075 IO,
00076 INVALID
00077 };
00078 virtual void start(
00079 Source_Ref source
00080 , Url url
00081 ) {}
00082
00083 virtual bool progress(int value, Url url)
00084 { return true; }
00085
00086 virtual Action problem(
00087 Url url
00088 , Error error
00089 , std::string description
00090 ) { return ABORT; }
00091
00092 virtual void finish(
00093 Url url
00094 , Error error
00095 , std::string reason
00096 ) {}
00097 };
00098
00099
00100 struct RefreshSourceReport : public callback::ReportBase
00101 {
00102 enum Action {
00103 ABORT,
00104 RETRY,
00105 IGNORE
00106 };
00107
00108 enum Error {
00109 NO_ERROR,
00110 NOT_FOUND,
00111 IO,
00112 INVALID
00113 };
00114 virtual void start(
00115 Source_Ref source
00116 , Url url
00117 ) {}
00118
00119 virtual bool progress(int value, Source_Ref source)
00120 { return true; }
00121
00122 virtual Action problem(
00123 Source_Ref source
00124 , Error error
00125 , std::string description
00126 ) { return ABORT; }
00127
00128 virtual void finish(
00129 Source_Ref source
00130 , Error error
00131 , std::string reason
00132 ) {}
00133 };
00134
00135
00136 struct CreateSourceReport : public callback::ReportBase
00137 {
00138 enum Action {
00139 ABORT,
00140 RETRY
00141 };
00142
00143 enum Error {
00144 NO_ERROR,
00145 NOT_FOUND,
00146 IO,
00147 INVALID
00148 };
00149
00150 virtual void startData(
00151 Url source_url
00152 ) {}
00153
00154 virtual void startProbe(Url url) {}
00155
00156 virtual void endProbe(Url url) {}
00157
00158 virtual bool progressData(int value, Url url)
00159 { return true; }
00160
00161 virtual Action problem(
00162 Url url
00163 , Error error
00164 , std::string description
00165 ) { return ABORT; }
00166
00167 virtual void finishData(
00168 Url url
00169 , Error error
00170 , std::string reason
00171 ) {}
00172 };
00173
00175 }
00177
00179 namespace media
00180 {
00181
00182 struct MediaChangeReport : public callback::ReportBase
00183 {
00184 enum Action {
00185 ABORT,
00186 RETRY,
00187 IGNORE,
00188 IGNORE_ID,
00189 CHANGE_URL,
00190 EJECT
00191 };
00192
00193 enum Error {
00194 NO_ERROR,
00195 NOT_FOUND,
00196 IO,
00197 INVALID,
00198 WRONG
00199 };
00200
00201 virtual Action requestMedia(
00202 const Source_Ref source
00203 , unsigned mediumNr
00204 , Error error
00205 , std::string description
00206 ) { return ABORT; }
00207 };
00208
00209
00210 struct DownloadProgressReport : public callback::ReportBase
00211 {
00212 enum Action {
00213 ABORT,
00214 RETRY,
00215 IGNORE
00216 };
00217
00218 enum Error {
00219 NO_ERROR,
00220 NOT_FOUND,
00221 IO
00222 };
00223
00224 virtual void start( Url file, Pathname localfile ) {}
00225
00226 virtual bool progress(int value, Url file)
00227 { return true; }
00228
00229 virtual Action problem(
00230 Url file
00231 , Error error
00232 , std::string description
00233 ) { return ABORT; }
00234
00235 virtual void finish(
00236 Url file
00237 , Error error
00238 , std::string reason
00239 ) {}
00240 };
00241
00243 }
00245
00247 namespace target
00248 {
00249
00250
00251 struct MessageResolvableReport : public callback::ReportBase
00252 {
00253 virtual void show(
00254 Message::constPtr message
00255 ) {}
00256 };
00257
00259 namespace rpm
00260 {
00261
00262
00263 struct InstallResolvableReport : public callback::ReportBase
00264 {
00265 enum Action {
00266 ABORT,
00267 RETRY,
00268 IGNORE
00269 };
00270
00271 enum Error {
00272 NO_ERROR,
00273 NOT_FOUND,
00274 IO,
00275 INVALID
00276 };
00277
00278
00279 enum RpmLevel {
00280 RPM,
00281 RPM_NODEPS,
00282 RPM_NODEPS_FORCE
00283 };
00284
00285 virtual void start(
00286 Resolvable::constPtr resolvable
00287 ) {}
00288
00289 virtual bool progress(int value, Resolvable::constPtr resolvable)
00290 { return true; }
00291
00292 virtual Action problem(
00293 Resolvable::constPtr resolvable
00294 , Error error
00295 , std::string description
00296 , RpmLevel level
00297 ) { return ABORT; }
00298
00299 virtual void finish(
00300 Resolvable::constPtr resolvable
00301 , Error error
00302 , std::string reason
00303 , RpmLevel level
00304 ) {}
00305 };
00306
00307
00308 struct RemoveResolvableReport : public callback::ReportBase
00309 {
00310 enum Action {
00311 ABORT,
00312 RETRY,
00313 IGNORE
00314 };
00315
00316 enum Error {
00317 NO_ERROR,
00318 NOT_FOUND,
00319 IO,
00320 INVALID
00321 };
00322
00323 virtual void start(
00324 Resolvable::constPtr resolvable
00325 ) {}
00326
00327 virtual bool progress(int value, Resolvable::constPtr resolvable)
00328 { return true; }
00329
00330 virtual Action problem(
00331 Resolvable::constPtr resolvable
00332 , Error error
00333 , std::string description
00334 ) { return ABORT; }
00335
00336 virtual void finish(
00337 Resolvable::constPtr resolvable
00338 , Error error
00339 , std::string reason
00340 ) {}
00341 };
00342
00343
00344 struct RebuildDBReport : public callback::ReportBase
00345 {
00346 enum Action {
00347 ABORT,
00348 RETRY,
00349 IGNORE
00350 };
00351
00352 enum Error {
00353 NO_ERROR,
00354 FAILED
00355 };
00356
00357 virtual void start(Pathname path) {}
00358
00359 virtual bool progress(int value, Pathname path)
00360 { return true; }
00361
00362 virtual Action problem(
00363 Pathname path
00364 , Error error
00365 , std::string description
00366 ) { return ABORT; }
00367
00368 virtual void finish(
00369 Pathname path
00370 , Error error
00371 , std::string reason
00372 ) {}
00373 };
00374
00375
00376 struct ConvertDBReport : public callback::ReportBase
00377 {
00378 enum Action {
00379 ABORT,
00380 RETRY,
00381 IGNORE
00382 };
00383
00384 enum Error {
00385 NO_ERROR,
00386 FAILED
00387 };
00388
00389 virtual void start(
00390 Pathname path
00391 ) {}
00392
00393 virtual bool progress(int value, Pathname path)
00394 { return true; }
00395
00396 virtual Action problem(
00397 Pathname path
00398 , Error error
00399 , std::string description
00400 ) { return ABORT; }
00401
00402 virtual void finish(
00403 Pathname path
00404 , Error error
00405 , std::string reason
00406 ) {}
00407 };
00408
00409
00410 struct ScanDBReport : public callback::ReportBase
00411 {
00412 enum Action {
00413 ABORT,
00414 RETRY,
00415 IGNORE
00416 };
00417
00418 enum Error {
00419 NO_ERROR,
00420 FAILED
00421 };
00422
00423 virtual void start(
00424 ) {}
00425
00426 virtual bool progress(int value)
00427 { return true; }
00428
00429 virtual Action problem(
00430 Error error
00431 , std::string description
00432 ) { return ABORT; }
00433
00434 virtual void finish(
00435 Error error
00436 , std::string reason
00437 ) {}
00438 };
00439
00441 }
00443
00445 }
00447
00449 }
00451
00452 #endif // ZYPP_ZYPPCALLBACKS_H