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>
28
29namespace cupt {
30
31namespace internal {
32
33class WorkerImpl;
34
35}
36
37namespace system {
38
40class 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];
68
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);
164
170 void saveSnapshot(const Snapshots&, const string& name);
178 const string& previousName, const string& newName);
184 void removeSnapshot(const Snapshots&, const string& name);
185};
186
187}
188}
189
190#endif
191
map< string, SuggestedPackage > SuggestedPackages
Definition: resolver.hpp:129
various snapshot-related routines
Definition: snapshots.hpp:38
performs system modifications
Definition: worker.hpp:41
void removeSnapshot(const Snapshots &, const string &name)
pair< size_t, size_t > getDownloadSizesPreview() const
map< string, ssize_t > getUnpackedSizesPreview() const
void setDesiredState(const Resolver::Offer &offer)
Worker(const shared_ptr< const Config > &config, const shared_ptr< const Cache > &cache)
constructor
void setPackagePurgeFlag(const string &packageName, bool value)
vector< pair< string, const BinaryVersion * > > getArchivesInfo() const
gets available archives of binary versions
void saveSnapshot(const Snapshots &, const string &name)
void renameSnapshot(const Snapshots &, const string &previousName, const string &newName)
void deleteArchive(const string &path)
void updateReleaseAndIndexData(const shared_ptr< download::Progress > &progress)
shared_ptr< const ActionsPreview > getActionsPreview() const
void changeSystem(const shared_ptr< download::Progress > &progress)
the result of resolver's work
Definition: resolver.hpp:132
action types
Definition: worker.hpp:49
Type
Definition: worker.hpp:50
@ Upgrade
new version of the existing package is installed
Definition: worker.hpp:54
@ Purge
the existing package is purged
Definition: worker.hpp:53
@ Deconfigure
the existing package in intermediate state is removed
Definition: worker.hpp:57
@ Reinstall
remove and install the installed version
Definition: worker.hpp:59
@ Remove
the existing package is removed
Definition: worker.hpp:52
@ Configure
the existing package in intermediate state is configured (properly installed)
Definition: worker.hpp:56
@ ProcessTriggers
triggers are processed for the existing package
Definition: worker.hpp:58
@ Downgrade
old version of the existing package is installed
Definition: worker.hpp:55
@ Install
a new package is installed
Definition: worker.hpp:51
Definition: worker.hpp:65
std::map< string, bool > autoFlagChanges
maps package name to target 'automatically installed' flag value
Definition: worker.hpp:75