|
Cupt
|
00001 /************************************************************************** 00002 * Copyright (C) 2010 by Eugene V. Lyubimkin * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License * 00006 * (version 3 or above) as published by the Free Software Foundation. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU GPL * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 00017 **************************************************************************/ 00018 #ifndef CUPT_SYSTEM_WORKER_SEEN 00019 #define CUPT_SYSTEM_WORKER_SEEN 00020 00022 00023 #include <map> 00024 00025 #include <cupt/common.hpp> 00026 #include <cupt/fwd.hpp> 00027 #include <cupt/system/resolver.hpp> 00028 00029 namespace cupt { 00030 00031 namespace internal { 00032 00033 class WorkerImpl; 00034 00035 } 00036 00037 namespace system { 00038 00040 class CUPT_API Worker 00041 { 00042 internal::WorkerImpl* __impl; 00043 00044 Worker(const Worker&); 00045 Worker& operator=(const Worker&); 00046 public: 00048 struct Action 00049 { 00050 enum Type { 00051 Install, 00052 Remove, 00053 Purge, 00054 Upgrade, 00055 Downgrade, 00056 Configure, 00057 Deconfigure, 00058 ProcessTriggers, 00059 Count 00060 }; 00061 }; 00062 struct ActionsPreview 00063 { 00064 Resolver::SuggestedPackages groups[Action::Count]; 00065 00066 00073 std::map< string, bool > autoFlagChanges; 00074 }; 00075 00077 00081 Worker(const shared_ptr< const Config >& config, const shared_ptr< const Cache >& cache); 00082 virtual ~Worker(); 00090 void setDesiredState(const Resolver::Offer& offer); 00091 00097 shared_ptr< const ActionsPreview > getActionsPreview() const; 00103 map< string, ssize_t > getUnpackedSizesPreview() const; 00109 pair< size_t, size_t > getDownloadSizesPreview() const; 00110 00117 void setAutomaticallyInstalledFlag(const string& packageName, bool value); 00124 void changeSystem(const shared_ptr< download::Progress >& progress); 00125 00132 void updateReleaseAndIndexData(const shared_ptr< download::Progress >& progress); 00133 00135 00142 vector< pair< string, shared_ptr< const BinaryVersion > > > getArchivesInfo() const; 00149 void deleteArchive(const string& path); 00150 00156 void saveSnapshot(const Snapshots&, const string& name); 00163 void renameSnapshot(const Snapshots&, 00164 const string& previousName, const string& newName); 00170 void removeSnapshot(const Snapshots&, const string& name); 00171 }; 00172 00173 } 00174 } 00175 00176 #endif 00177
1.7.4