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

Generated on Thu Jul 6 00:07:29 2006 for zypp by  doxygen 1.4.6