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 {
60  Count
61  };
62  static const char* rawStrings[Count];
63  };
65  {
66  Resolver::SuggestedPackages groups[Action::Count];
67 
75  std::map< string, bool > autoFlagChanges;
76  };
77 
79 
83  Worker(const shared_ptr< const Config >& config, const shared_ptr< const Cache >& cache);
84  virtual ~Worker();
92  void setDesiredState(const Resolver::Offer& offer);
107  void setPackagePurgeFlag(const string& packageName, bool value);
108 
114  shared_ptr< const ActionsPreview > getActionsPreview() const;
120  map< string, ssize_t > getUnpackedSizesPreview() const;
126  pair< size_t, size_t > getDownloadSizesPreview() const;
127 
134  void changeSystem(const shared_ptr< download::Progress >& progress);
135 
142  void updateReleaseAndIndexData(const shared_ptr< download::Progress >& progress);
143 
145 
152  vector< pair< string, const BinaryVersion* > > getArchivesInfo() const;
159  void deleteArchive(const string& path);
163  void deletePartialArchives();
164 
170  void saveSnapshot(const Snapshots&, const string& name);
177  void renameSnapshot(const Snapshots&,
178  const string& previousName, const string& newName);
184  void removeSnapshot(const Snapshots&, const string& name);
185 };
186 
187 }
188 }
189 
190 #endif
191 
resolver.hpp
common.hpp
cupt::system::Resolver::SuggestedPackages
map< string, SuggestedPackage > SuggestedPackages
Definition: resolver.hpp:129
cupt::system::Worker::Action::Reinstall
@ Reinstall
remove and install the installed version
Definition: worker.hpp:59
cupt::system::Worker::ActionsPreview::autoFlagChanges
std::map< string, bool > autoFlagChanges
maps package name to target 'automatically installed' flag value
Definition: worker.hpp:75
cupt::system::Snapshots
various snapshot-related routines
Definition: snapshots.hpp:37
cupt::system::Worker::Action::ProcessTriggers
@ ProcessTriggers
triggers are processed for the existing package
Definition: worker.hpp:58
cupt::system::Worker::Action::Upgrade
@ Upgrade
new version of the existing package is installed
Definition: worker.hpp:54
cupt::system::Worker::ActionsPreview
Definition: worker.hpp:64
cupt::system::Worker::Action::Deconfigure
@ Deconfigure
the existing package in intermediate state is removed
Definition: worker.hpp:57
cupt::system::Worker::Action::Remove
@ Remove
the existing package is removed
Definition: worker.hpp:52
cupt::system::Worker
performs system modifications
Definition: worker.hpp:40
cupt::system::Worker::Action
action types
Definition: worker.hpp:48
cupt::system::Worker::Action::Install
@ Install
a new package is installed
Definition: worker.hpp:51
cupt::system::Worker::Action::Type
Type
Definition: worker.hpp:50
cupt::system::Worker::Action::Purge
@ Purge
the existing package is purged
Definition: worker.hpp:53
cupt::system::Worker::Action::Configure
@ Configure
the existing package in intermediate state is configured (properly installed)
Definition: worker.hpp:56
cupt::system::Resolver::Offer
the result of resolver's work
Definition: resolver.hpp:131
cupt::system::Worker::Action::Downgrade
@ Downgrade
old version of the existing package is installed
Definition: worker.hpp:55