00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */ 00002 00003 /* 00004 * Copyright (c) 2006, 2007 Ciaran McCreesh 00005 * 00006 * This file is part of the Paludis package manager. Paludis is free software; 00007 * you can redistribute it and/or modify it under the terms of the GNU General 00008 * Public License version 2, as published by the Free Software Foundation. 00009 * 00010 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY 00011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00013 * details. 00014 * 00015 * You should have received a copy of the GNU General Public License along with 00016 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00017 * Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef PALUDIS_GUARD_PALUDIS_SYNC_TASK_HH 00021 #define PALUDIS_GUARD_PALUDIS_SYNC_TASK_HH 1 00022 00023 #include <paludis/util/instantiation_policy.hh> 00024 #include <paludis/util/private_implementation_pattern.hh> 00025 #include <paludis/util/wrapped_forward_iterator-fwd.hh> 00026 #include <paludis/dep_list.hh> 00027 00028 /** \file 00029 * Declarations for SyncTask. 00030 * 00031 * \ingroup g_tasks 00032 * 00033 * \section Examples 00034 * 00035 * - None at this time. 00036 */ 00037 00038 namespace paludis 00039 { 00040 class Environment; 00041 class SyncFailedError; 00042 00043 /** 00044 * Task to handle syncing some or all repositories. 00045 * 00046 * \ingroup g_tasks 00047 * \nosubgrouping 00048 */ 00049 class PALUDIS_VISIBLE SyncTask : 00050 PrivateImplementationPattern<SyncTask>, 00051 InstantiationPolicy<SyncTask, instantiation_method::NonCopyableTag> 00052 { 00053 protected: 00054 ///\name Basic operations 00055 ///\{ 00056 00057 SyncTask(Environment * const env, const bool parallel); 00058 00059 ///\} 00060 00061 public: 00062 ///\name Basic operations 00063 ///\{ 00064 00065 virtual ~SyncTask(); 00066 00067 ///\} 00068 00069 ///\name Add targets 00070 ///\{ 00071 00072 void add_target(const std::string &); 00073 00074 ///\} 00075 00076 ///\name Event callbacks 00077 ///\{ 00078 00079 virtual void on_sync_all_pre() = 0; 00080 virtual void on_sync_pre(const RepositoryName &) = 0; 00081 virtual void on_sync_post(const RepositoryName &) = 0; 00082 virtual void on_sync_skip(const RepositoryName &) = 0; 00083 virtual void on_sync_fail(const RepositoryName &, const SyncFailedError &) = 0; 00084 virtual void on_sync_succeed(const RepositoryName &) = 0; 00085 virtual void on_sync_all_post() = 0; 00086 00087 virtual void on_sync_status(const int x, const int y, const int a) = 0; 00088 00089 ///\} 00090 00091 ///\name Target iteration 00092 ///\{ 00093 00094 struct TargetsConstIteratorTag; 00095 typedef WrappedForwardIterator<TargetsConstIteratorTag, const RepositoryName> TargetsConstIterator; 00096 TargetsConstIterator begin_targets() const; 00097 TargetsConstIterator end_targets() const; 00098 00099 ///\} 00100 00101 /** 00102 * Run the task. 00103 */ 00104 virtual void execute(); 00105 }; 00106 } 00107 00108 #endif