Cupt
Classes | Public Member Functions | List of all members
cupt::system::Worker Class Reference

performs system modifications More...

#include <cupt/system/worker.hpp>

Classes

struct  Action
 action types More...
 
struct  ActionsPreview
 

Public Member Functions

 Worker (const shared_ptr< const Config > &config, const shared_ptr< const Cache > &cache)
 constructor More...
 
void setDesiredState (const Resolver::Offer &offer)
 
void setPackagePurgeFlag (const string &packageName, bool value)
 
shared_ptr< const ActionsPreviewgetActionsPreview () const
 
map< string, ssize_t > getUnpackedSizesPreview () const
 
pair< size_t, size_t > getDownloadSizesPreview () const
 
void changeSystem (const shared_ptr< download::Progress > &progress)
 
void updateReleaseAndIndexData (const shared_ptr< download::Progress > &progress)
 
vector< pair< string, const BinaryVersion * > > getArchivesInfo () const
 gets available archives of binary versions More...
 
void deleteArchive (const string &path)
 
void deletePartialArchives ()
 
void saveSnapshot (const Snapshots &, const string &name)
 
void renameSnapshot (const Snapshots &, const string &previousName, const string &newName)
 
void removeSnapshot (const Snapshots &, const string &name)
 

Detailed Description

performs system modifications

Constructor & Destructor Documentation

◆ Worker()

cupt::system::Worker::Worker ( const shared_ptr< const Config > &  config,
const shared_ptr< const Cache > &  cache 
)

constructor

Parameters
config
cache

Member Function Documentation

◆ changeSystem()

void cupt::system::Worker::changeSystem ( const shared_ptr< download::Progress > &  progress)

Modifies the system to achieve the desired state set by setDesiredState.

Parameters
progress

◆ deleteArchive()

void cupt::system::Worker::deleteArchive ( const string &  path)

Deletes an archive file (it may be a symlink). Verifies that deleted file is located under archives path directory.

Parameters
pathabsolute (i.e., not relative) path to file

◆ deletePartialArchives()

void cupt::system::Worker::deletePartialArchives ( )

Deletes all partially downloaded archive files.

◆ getActionsPreview()

shared_ptr< const ActionsPreview > cupt::system::Worker::getActionsPreview ( ) const

Shouldn't be called before setDesiredState.

Returns
a set of actions to get the desired system state divided by action types

◆ getArchivesInfo()

vector< pair< string, const BinaryVersion* > > cupt::system::Worker::getArchivesInfo ( ) const

gets available archives of binary versions

Gets paths of all '.deb' archives in the archives directory and matches them to available binary versions. Not matched paths with be paired with an empty pointer.

Returns
array of pairs < package name, pointer to binary version >

◆ getDownloadSizesPreview()

pair< size_t, size_t > cupt::system::Worker::getDownloadSizesPreview ( ) const

Shouldn't be called before setDesiredState.

Returns
pair: total amount of needed binary archives (in bytes), amount to download (in bytes)

◆ getUnpackedSizesPreview()

map< string, ssize_t > cupt::system::Worker::getUnpackedSizesPreview ( ) const

Shouldn't be called before setDesiredState.

Returns
map: package name -> unpacked size change (in bytes)

◆ removeSnapshot()

void cupt::system::Worker::removeSnapshot ( const Snapshots ,
const string &  name 
)

Removes a system snapshot.

Parameters
namename of the snapshot

◆ renameSnapshot()

void cupt::system::Worker::renameSnapshot ( const Snapshots ,
const string &  previousName,
const string &  newName 
)

Renames a system snapshot.

Parameters
previousNameprevious snasphot name
newNamenew snapshot name

◆ saveSnapshot()

void cupt::system::Worker::saveSnapshot ( const Snapshots ,
const string &  name 
)

Makes a system snapshot with a name name.

Parameters
namethe snapshot name.

◆ setDesiredState()

void cupt::system::Worker::setDesiredState ( const Resolver::Offer offer)

Sets the desired system state.

May be called several times for examining different possible system states.

Parameters
offer

◆ setPackagePurgeFlag()

void cupt::system::Worker::setPackagePurgeFlag ( const string &  packageName,
bool  value 
)

Sets the purge flag for removed packages.

Removed packages can be either simply removed or removed along with their configuration files (purged).

Changes which are made by this method are not visible until you call setDesiredState. If some calls of this method were made after a last call to setDesiredState, you must call setDesiredState again.

Parameters
packageNamebinary package name to modify a flag value for
valuethe target state of the flag

◆ updateReleaseAndIndexData()

void cupt::system::Worker::updateReleaseAndIndexData ( const shared_ptr< download::Progress > &  progress)

Downloads latest Release and Packages/Sources files from repository sources.

Parameters
progress

The documentation for this class was generated from the following file: