Cupt
worker.hpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010 by Eugene V. Lyubimkin *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License *
6 * (version 3 or above) as published by the Free Software Foundation. *
7 * *
8 * This program is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11 * GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU GPL *
14 * along with this program; if not, write to the *
15 * Free Software Foundation, Inc., *
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17 **************************************************************************/
18 #ifndef CUPT_SYSTEM_WORKER_SEEN
19 #define CUPT_SYSTEM_WORKER_SEEN
20 
22 
23 #include <map>
24 
25 #include <cupt/common.hpp>
26 #include <cupt/fwd.hpp>
27 #include <cupt/system/resolver.hpp>
28 
29 namespace cupt {
30 
31 namespace internal {
32 
33 class WorkerImpl;
34 
35 }
36 
37 namespace system {
38 
40 class CUPT_API Worker
41 {
42  internal::WorkerImpl* __impl;
43 
44  Worker(const Worker&);
45  Worker& operator=(const Worker&);
46  public:
48  struct Action
49  {
50  enum Type {
59  Count
60  };
61  static const char* rawStrings[Count];
62  };
64  {
65  Resolver::SuggestedPackages groups[Action::Count];
66 
67 
74  std::map< string, bool > autoFlagChanges;
75  };
76 
78 
82  Worker(const shared_ptr< const Config >& config, const shared_ptr< const Cache >& cache);
83  virtual ~Worker();
91  void setDesiredState(const Resolver::Offer& offer);
108  void setPackagePurgeFlag(const string& packageName, bool value);
109 
115  shared_ptr< const ActionsPreview > getActionsPreview() const;
121  map< string, ssize_t > getUnpackedSizesPreview() const;
127  pair< size_t, size_t > getDownloadSizesPreview() const;
128 
135  void setAutomaticallyInstalledFlag(const string& packageName, bool value);
142  void changeSystem(const shared_ptr< download::Progress >& progress);
143 
150  void updateReleaseAndIndexData(const shared_ptr< download::Progress >& progress);
151 
153 
160  vector< pair< string, shared_ptr< const BinaryVersion > > > getArchivesInfo() const;
167  void deleteArchive(const string& path);
171  void deletePartialArchives();
172 
178  void saveSnapshot(const Snapshots&, const string& name);
185  void renameSnapshot(const Snapshots&,
186  const string& previousName, const string& newName);
192  void removeSnapshot(const Snapshots&, const string& name);
193 };
194 
195 }
196 }
197 
198 #endif
199