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

Generated on Thu Sep 14 15:39:02 2006 for zypp by  doxygen 1.4.6