ZYppCallbacks.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
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     // progress for downloading a resolvable
00028     struct DownloadResolvableReport : public callback::ReportBase
00029     {
00030       enum Action { 
00031         ABORT,  // abort and return error
00032         RETRY   // retry
00033       }; 
00034       
00035       enum Error {
00036         NO_ERROR,
00037         NOT_FOUND,      // the requested Url was not found
00038         IO,             // IO error
00039         INVALID         // the downloaded file is invalid
00040       };
00041 
00042       virtual void start(
00043         Resolvable::constPtr resolvable_ptr
00044         , Url url
00045       ) {}
00046 
00047       // return false if the download should be aborted right now
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     // progress for downloading a specific file
00065     struct DownloadFileReport : public callback::ReportBase
00066     {
00067       enum Action { 
00068         ABORT,  // abort and return error
00069         RETRY   // retry
00070       }; 
00071       
00072       enum Error {
00073         NO_ERROR,
00074         NOT_FOUND,      // the requested Url was not found
00075         IO,             // IO error
00076         INVALID         // the downloaded file is 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     // progress for refreshing a source data
00100     struct RefreshSourceReport : public callback::ReportBase
00101     {
00102       enum Action { 
00103         ABORT,  // abort and return error
00104         RETRY,  // retry
00105         IGNORE  // skip refresh, ignore failed refresh
00106       }; 
00107       
00108       enum Error {
00109         NO_ERROR,
00110         NOT_FOUND,      // the requested Url was not found
00111         IO,             // IO error
00112         INVALID         // th source is 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     // progress for creating a source (download and parsing)
00136     struct CreateSourceReport : public callback::ReportBase
00137     {
00138       enum Action { 
00139         ABORT,  // abort and return error
00140         RETRY   // retry
00141       }; 
00142       
00143       enum Error {
00144         NO_ERROR,
00145         NOT_FOUND,      // the requested Url was not found
00146         IO,             // IO error
00147         INVALID         // th source is 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   } // namespace source
00177   
00179   namespace media 
00180   { 
00181     // media change request callback
00182     struct MediaChangeReport : public callback::ReportBase
00183     {
00184       enum Action { 
00185         ABORT,  // abort and return error
00186         RETRY,  // retry
00187         IGNORE, // ignore this media in future, not available anymore
00188         IGNORE_ID,      // ignore wrong medium id
00189         CHANGE_URL,     // change media URL
00190         EJECT           // eject the medium
00191       }; 
00192 
00193       enum Error { 
00194         NO_ERROR,
00195         NOT_FOUND,  // the medie not found at all
00196         IO,     // error accessing the media
00197         INVALID, // media is broken
00198         WRONG   // wrong media, need a different one
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     // progress for downloading a file
00210     struct DownloadProgressReport : public callback::ReportBase
00211     {
00212         enum Action { 
00213           ABORT,  // abort and return error
00214           RETRY,        // retry
00215           IGNORE        // ignore the failure
00216         }; 
00217       
00218         enum Error {
00219           NO_ERROR,
00220           NOT_FOUND,    // the requested Url was not found
00221           IO            // IO error
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   } // namespace media
00245 
00247   namespace target 
00248   { 
00249   
00250     // resolvable Message
00251     struct MessageResolvableReport : public callback::ReportBase
00252     {
00253         virtual void show(
00254           Message::constPtr message
00255         ) {}    
00256     };
00257   
00259     namespace rpm 
00260     { 
00261 
00262       // progress for installing a resolvable
00263       struct InstallResolvableReport : public callback::ReportBase
00264       {
00265         enum Action { 
00266           ABORT,  // abort and return error
00267           RETRY,        // retry
00268           IGNORE        // ignore the failure
00269         }; 
00270       
00271         enum Error {
00272           NO_ERROR,
00273           NOT_FOUND,    // the requested Url was not found
00274           IO,           // IO error
00275           INVALID               // th resolvable is invalid
00276         };
00277       
00278         // the level of RPM pushing
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       // progress for removing a resolvable
00308       struct RemoveResolvableReport : public callback::ReportBase
00309       {
00310         enum Action { 
00311           ABORT,  // abort and return error
00312           RETRY,        // retry
00313           IGNORE        // ignore the failure
00314         }; 
00315       
00316         enum Error {
00317           NO_ERROR,
00318           NOT_FOUND,    // the requested Url was not found
00319           IO,           // IO error
00320           INVALID               // th resolvable is 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       // progress for rebuilding the database
00344       struct RebuildDBReport : public callback::ReportBase
00345       {
00346         enum Action { 
00347           ABORT,  // abort and return error
00348           RETRY,        // retry
00349           IGNORE        // ignore the failure
00350         }; 
00351       
00352         enum Error {
00353           NO_ERROR,
00354           FAILED                // failed to rebuild
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       // progress for converting the database
00376       struct ConvertDBReport : public callback::ReportBase
00377       {
00378         enum Action { 
00379           ABORT,  // abort and return error
00380           RETRY,        // retry
00381           IGNORE        // ignore the failure
00382         }; 
00383       
00384         enum Error {
00385           NO_ERROR,
00386           FAILED                // conversion 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        // progress for scanning the database
00410       struct ScanDBReport : public callback::ReportBase
00411       {
00412         enum Action { 
00413           ABORT,  // abort and return error
00414           RETRY,        // retry
00415           IGNORE        // ignore the failure
00416         }; 
00417       
00418         enum Error {
00419           NO_ERROR,
00420           FAILED                // conversion 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     } // namespace rpm
00443 
00445   } // namespace target
00447 
00449 } // namespace zypp
00451 
00452 #endif // ZYPP_ZYPPCALLBACKS_H

Generated on Mon Jun 5 19:10:46 2006 for zypp by  doxygen 1.4.6