PackageManager
PackageManager
#include <icy/pacm/packagemanager.h>class PackageManagerDefined in src/pacm/include/icy/pacm/packagemanager.h:62
Loads package manifests and coordinates install, update, and uninstall workflows.
List of all members
| Name | Kind | Owner |
|---|---|---|
RemotePackageResponse | variable | Declared here |
PackageUninstalled | variable | Declared here |
InstallTaskCreated | variable | Declared here |
InstallTaskComplete | variable | Declared here |
PackageManager | function | Declared here |
~PackageManager | function | Declared here |
PackageManager | function | Declared here |
operator= | function | Declared here |
PackageManager | function | Declared here |
operator= | function | Declared here |
initialize | function | Declared here |
uninitialize | function | Declared here |
initialized | function | Declared here |
createDirectories | function | Declared here |
queryRemotePackages | function | Declared here |
loadLocalPackages | function | Declared here |
loadLocalPackages | function | Declared here |
saveLocalPackages | function | Declared here |
saveLocalPackage | function | Declared here |
parseRemotePackages | function | Declared here |
installPackage | function | Declared here |
installPackages | function | Declared here |
updatePackage | function | Declared here |
updatePackages | function | Declared here |
updateAllPackages | function | Declared here |
uninstallPackages | function | Declared here |
uninstallPackage | function | Declared here |
hasUnfinalizedPackages | function | Declared here |
finalizeInstallations | function | Declared here |
getInstallTask | function | Declared here |
tasks | function | Declared here |
cancelAllTasks | function | Declared here |
getPackagePairs | function | Declared here |
getUpdatablePackagePairs | function | Declared here |
getPackagePair | function | Declared here |
getOrCreatePackagePair | function | Declared here |
createInstallTask | function | Declared here |
installedPackageVersion | function | Declared here |
getLatestInstallableAsset | function | Declared here |
hasAvailableUpdates | function | Declared here |
clearCache | function | Declared here |
clearPackageCache | function | Declared here |
clearCacheFile | function | Declared here |
hasCachedFile | function | Declared here |
isSupportedFileType | function | Declared here |
getCacheFilePath | function | Declared here |
getPackageDataDir | function | Declared here |
mutableOptions | function | Declared here |
options | function | Declared here |
remotePackages | function | Declared here |
localPackages | function | Declared here |
_mutex | variable | Declared here |
_localPackages | variable | Declared here |
_remotePackages | variable | Declared here |
_tasks | variable | Declared here |
_options | variable | Declared here |
onPackageInstallComplete | function | Declared here |
Public Attributes
| Return | Name | Description |
|---|---|---|
Signal< void(const http::Response &)> | RemotePackageResponse | Events. |
Signal< void(LocalPackage &)> | PackageUninstalled | Signals when a package is uninstalled. |
Signal< void(InstallTask &)> | InstallTaskCreated | Signals when an installation task is created, before it is started. |
Signal< void(const InstallTask &)> | InstallTaskComplete | Signals when a package installation tasks completes, either successfully or in error. |
RemotePackageResponse
Signal< void(const http::Response &)> RemotePackageResponseDefined in src/pacm/include/icy/pacm/packagemanager.h:311
Events.
Signals when the remote package list have been downloaded from the server.
PackageUninstalled
Signal< void(LocalPackage &)> PackageUninstalledDefined in src/pacm/include/icy/pacm/packagemanager.h:314
Signals when a package is uninstalled.
InstallTaskCreated
Signal< void(InstallTask &)> InstallTaskCreatedDefined in src/pacm/include/icy/pacm/packagemanager.h:318
Signals when an installation task is created, before it is started.
InstallTaskComplete
Signal< void(const InstallTask &)> InstallTaskCompleteDefined in src/pacm/include/icy/pacm/packagemanager.h:322
Signals when a package installation tasks completes, either successfully or in error.
Public Methods
| Return | Name | Description |
|---|---|---|
PackageManager | ||
PackageManager | Deleted constructor. | |
PackageManager | Deleted constructor. | |
void | initialize virtual | Initialization Methods. |
void | uninitialize virtual | Releases resources and cancels any in-progress tasks. |
bool | initialized virtual const | Returns true if initialize() has been called successfully. |
void | createDirectories virtual | Creates the package manager directory structure if it does not already exist. |
void | queryRemotePackages virtual | Queries the server for a list of available packages. |
void | loadLocalPackages virtual | Loads all local package manifests from file system. Clears all in memory package manifests. |
void | loadLocalPackages virtual | Loads all local package manifests residing the the given directory. This method may be called multiple times for different paths because it does not clear in memory package manifests. |
bool | saveLocalPackages virtual | Saves all local package manifests to the data directory. |
bool | saveLocalPackage virtual | Saves the local package manifest to the file system. |
void | parseRemotePackages virtual | Parse the remote packages from the given JSON data string. |
InstallTask::Ptr | installPackage virtual | Package Installation Methods. |
bool | installPackages virtual | Installs multiple packages. The same options will be passed to each task. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor. |
InstallTask::Ptr | updatePackage virtual | Updates a single package. Throws an exception if the package does not exist. The returned InstallTask must be started. |
bool | updatePackages virtual | Updates multiple packages. Throws an exception if the package does not exist. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor. |
bool | updateAllPackages virtual | Updates all installed packages. |
bool | uninstallPackages virtual | Uninstalls multiple packages. |
bool | uninstallPackage virtual | Uninstalls a single package. |
bool | hasUnfinalizedPackages virtual | Returns true if there are updates available that have not yet been finalized. Packages may be unfinalized if there were files in use at the time of installation. |
bool | finalizeInstallations virtual | Finalizes active installations by moving all package files to their target destination. If files are to be overwritten they must not be in use or finalization will fail. |
InstallTask::Ptr | getInstallTask virtual const | Task Helper Methods. |
InstallTaskPtrVec | tasks virtual const | Returns a list of all tasks. |
void | cancelAllTasks virtual | Aborts all package installation tasks. All tasks must be aborted before clearing local or remote manifests. |
PackagePairVec | getPackagePairs virtual const | Package Helper Methods. |
PackagePairVec | getUpdatablePackagePairs virtual const | Returns a list of package pairs which may be updated. All pairs will have both local and remote package pointers, and the remote version will be newer than the local version. |
PackagePair | getPackagePair virtual const | Returns a local and remote package pair. An exception will be thrown if either the local or remote packages aren't available or are invalid. |
PackagePair | getOrCreatePackagePair virtual | Returns a local and remote package pair. If the local package doesn't exist it will be created from the remote package. If the remote package doesn't exist a NotFoundException will be thrown. |
InstallTask::Ptr | createInstallTask virtual | Creates a package installation task for the given pair. |
std::string | installedPackageVersion virtual const | Returns the version number of an installed package. Exceptions will be thrown if the package does not exist, or is not fully installed. |
Package::Asset | getLatestInstallableAsset virtual const | Returns the best asset to install, or throws a descriptive exception if no updates are available, or if the package is already up-to-date. This method takes version and SDK locks into consideration. |
bool | hasAvailableUpdates virtual const | Returns true if there are updates available for this package, false otherwise. |
void | clearCache | File Helper Methods. |
bool | clearPackageCache | Clears a package archive from the local cache. |
bool | clearCacheFile | Clears a file from the local cache. |
bool | hasCachedFile | Checks if a package archive exists in the local cache. |
bool | isSupportedFileType | Checks if the file type is a supported package archive. |
std::string | getCacheFilePath | Returns the full path of the cached file if it exists, or an empty path if the file doesn't exist. |
std::string | getPackageDataDir | Returns the package data directory for the given package ID. |
Options & | mutableOptions virtual | Accessors. |
const Options & | options virtual const | Returns a read-only view of the current options. |
RemotePackageStore & | remotePackages virtual | Returns a reference to the in-memory remote package store. |
LocalPackageStore & | localPackages virtual | Returns a reference to the in-memory local package store. |
PackageManager
PackageManager(const Options & options = Options())Defined in src/pacm/include/icy/pacm/packagemanager.h:99
Parameters
optionsConfiguration for directories, endpoints, and credentials.
PackageManager
PackageManager(const PackageManager &) = deleteDefined in src/pacm/include/icy/pacm/packagemanager.h:102
Deleted constructor.
PackageManager
PackageManager(PackageManager &&) = deleteDefined in src/pacm/include/icy/pacm/packagemanager.h:104
Deleted constructor.
initialize
virtual
virtual void initialize()Defined in src/pacm/include/icy/pacm/packagemanager.h:112
Initialization Methods.
Initializes the package manager: creates directories, loads local manifests, and queries the remote package index.
uninitialize
virtual
virtual void uninitialize()Defined in src/pacm/include/icy/pacm/packagemanager.h:115
Releases resources and cancels any in-progress tasks.
initialized
virtual const
virtual bool initialized() constDefined in src/pacm/include/icy/pacm/packagemanager.h:118
Returns true if initialize() has been called successfully.
createDirectories
virtual
virtual void createDirectories()Defined in src/pacm/include/icy/pacm/packagemanager.h:122
Creates the package manager directory structure if it does not already exist.
queryRemotePackages
virtual
virtual void queryRemotePackages()Defined in src/pacm/include/icy/pacm/packagemanager.h:125
Queries the server for a list of available packages.
loadLocalPackages
virtual
virtual void loadLocalPackages()Defined in src/pacm/include/icy/pacm/packagemanager.h:129
Loads all local package manifests from file system. Clears all in memory package manifests.
loadLocalPackages
virtual
virtual void loadLocalPackages(const std::string & dir)Defined in src/pacm/include/icy/pacm/packagemanager.h:135
Loads all local package manifests residing the the given directory. This method may be called multiple times for different paths because it does not clear in memory package manifests.
saveLocalPackages
virtual
virtual bool saveLocalPackages(bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:140
Saves all local package manifests to the data directory.
Parameters
whinyIf true, re-throws on write error; otherwise returns false.
Returns
true on success.
saveLocalPackage
virtual
virtual bool saveLocalPackage(LocalPackage & package, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:143
Saves the local package manifest to the file system.
parseRemotePackages
virtual
virtual void parseRemotePackages(const std::string & data)Defined in src/pacm/include/icy/pacm/packagemanager.h:146
Parse the remote packages from the given JSON data string.
installPackage
virtual
virtual InstallTask::Ptr installPackage(const std::string & name, const InstallOptions & options = InstallOptions())Defined in src/pacm/include/icy/pacm/packagemanager.h:156
Package Installation Methods.
Installs a single package. The returned InstallTask must be started. If the package is already up-to-date, a nullptr will be returned. Any other error will throw a std::runtime_error.
installPackages
virtual
virtual bool installPackages(const StringVec & ids, const InstallOptions & options = InstallOptions(), InstallMonitor * monitor = nullptr, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:165
Installs multiple packages. The same options will be passed to each task. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor.
updatePackage
virtual
virtual InstallTask::Ptr updatePackage(const std::string & name, const InstallOptions & options = InstallOptions())Defined in src/pacm/include/icy/pacm/packagemanager.h:173
Updates a single package. Throws an exception if the package does not exist. The returned InstallTask must be started.
updatePackages
virtual
virtual bool updatePackages(const StringVec & ids, const InstallOptions & options = InstallOptions(), InstallMonitor * monitor = nullptr, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:182
Updates multiple packages. Throws an exception if the package does not exist. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor.
updateAllPackages
virtual
virtual bool updateAllPackages(bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:187
Updates all installed packages.
uninstallPackages
virtual
virtual bool uninstallPackages(const StringVec & ids, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:190
Uninstalls multiple packages.
uninstallPackage
virtual
virtual bool uninstallPackage(const std::string & id, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:193
Uninstalls a single package.
hasUnfinalizedPackages
virtual
virtual bool hasUnfinalizedPackages()Defined in src/pacm/include/icy/pacm/packagemanager.h:198
Returns true if there are updates available that have not yet been finalized. Packages may be unfinalized if there were files in use at the time of installation.
finalizeInstallations
virtual
virtual bool finalizeInstallations(bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:204
Finalizes active installations by moving all package files to their target destination. If files are to be overwritten they must not be in use or finalization will fail.
getInstallTask
virtual const
virtual InstallTask::Ptr getInstallTask(const std::string & id) constDefined in src/pacm/include/icy/pacm/packagemanager.h:210
Task Helper Methods.
Gets the install task for the given package ID.
tasks
virtual const
virtual InstallTaskPtrVec tasks() constDefined in src/pacm/include/icy/pacm/packagemanager.h:213
Returns a list of all tasks.
cancelAllTasks
virtual
virtual void cancelAllTasks()Defined in src/pacm/include/icy/pacm/packagemanager.h:217
Aborts all package installation tasks. All tasks must be aborted before clearing local or remote manifests.
getPackagePairs
virtual const
virtual PackagePairVec getPackagePairs() constDefined in src/pacm/include/icy/pacm/packagemanager.h:224
Package Helper Methods.
Returns all package pairs, valid or invalid. Some pairs may not have both local and remote package pointers.
getUpdatablePackagePairs
virtual const
virtual PackagePairVec getUpdatablePackagePairs() constDefined in src/pacm/include/icy/pacm/packagemanager.h:229
Returns a list of package pairs which may be updated. All pairs will have both local and remote package pointers, and the remote version will be newer than the local version.
getPackagePair
virtual const
virtual PackagePair getPackagePair(const std::string & id, bool whiny = false) constDefined in src/pacm/include/icy/pacm/packagemanager.h:234
Returns a local and remote package pair. An exception will be thrown if either the local or remote packages aren't available or are invalid.
getOrCreatePackagePair
virtual
virtual PackagePair getOrCreatePackagePair(const std::string & id)Defined in src/pacm/include/icy/pacm/packagemanager.h:242
Returns a local and remote package pair. If the local package doesn't exist it will be created from the remote package. If the remote package doesn't exist a NotFoundException will be thrown.
createInstallTask
virtual
virtual InstallTask::Ptr createInstallTask(PackagePair & pair, const InstallOptions & options = InstallOptions())Defined in src/pacm/include/icy/pacm/packagemanager.h:245
Creates a package installation task for the given pair.
installedPackageVersion
virtual const
virtual std::string installedPackageVersion(const std::string & id) constDefined in src/pacm/include/icy/pacm/packagemanager.h:251
Returns the version number of an installed package. Exceptions will be thrown if the package does not exist, or is not fully installed.
getLatestInstallableAsset
virtual const
virtual Package::Asset getLatestInstallableAsset(const PackagePair & pair, const InstallOptions & options = InstallOptions()) constDefined in src/pacm/include/icy/pacm/packagemanager.h:256
Returns the best asset to install, or throws a descriptive exception if no updates are available, or if the package is already up-to-date. This method takes version and SDK locks into consideration.
hasAvailableUpdates
virtual const
virtual bool hasAvailableUpdates(const PackagePair & pair) constDefined in src/pacm/include/icy/pacm/packagemanager.h:262
Returns true if there are updates available for this package, false otherwise.
clearCache
void clearCache()Defined in src/pacm/include/icy/pacm/packagemanager.h:268
File Helper Methods.
Clears all files in the cache directory.
clearPackageCache
bool clearPackageCache(LocalPackage & package)Defined in src/pacm/include/icy/pacm/packagemanager.h:271
Clears a package archive from the local cache.
clearCacheFile
bool clearCacheFile(std::string_view fileName, bool whiny = false)Defined in src/pacm/include/icy/pacm/packagemanager.h:274
Clears a file from the local cache.
hasCachedFile
bool hasCachedFile(Package::Asset & asset)Defined in src/pacm/include/icy/pacm/packagemanager.h:277
Checks if a package archive exists in the local cache.
isSupportedFileType
bool isSupportedFileType(std::string_view fileName)Defined in src/pacm/include/icy/pacm/packagemanager.h:280
Checks if the file type is a supported package archive.
getCacheFilePath
std::string getCacheFilePath(std::string_view fileName)Defined in src/pacm/include/icy/pacm/packagemanager.h:284
Returns the full path of the cached file if it exists, or an empty path if the file doesn't exist.
getPackageDataDir
std::string getPackageDataDir(std::string_view id)Defined in src/pacm/include/icy/pacm/packagemanager.h:288
Returns the package data directory for the given package ID.
mutableOptions
virtual
virtual Options & mutableOptions()Defined in src/pacm/include/icy/pacm/packagemanager.h:295
Accessors.
Returns the mutable startup configuration for this manager. Callers should finish edits before initialize().
options
virtual const
virtual const Options & options() constDefined in src/pacm/include/icy/pacm/packagemanager.h:298
Returns a read-only view of the current options.
remotePackages
virtual
virtual RemotePackageStore & remotePackages()Defined in src/pacm/include/icy/pacm/packagemanager.h:301
Returns a reference to the in-memory remote package store.
localPackages
virtual
virtual LocalPackageStore & localPackages()Defined in src/pacm/include/icy/pacm/packagemanager.h:304
Returns a reference to the in-memory local package store.
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::mutex | _mutex | |
LocalPackageStore | _localPackages | |
RemotePackageStore | _remotePackages | |
InstallTaskPtrVec | _tasks | |
Options | _options |
_mutex
std::mutex _mutexDefined in src/pacm/include/icy/pacm/packagemanager.h:331
_localPackages
LocalPackageStore _localPackagesDefined in src/pacm/include/icy/pacm/packagemanager.h:332
_remotePackages
RemotePackageStore _remotePackagesDefined in src/pacm/include/icy/pacm/packagemanager.h:333
_tasks
InstallTaskPtrVec _tasksDefined in src/pacm/include/icy/pacm/packagemanager.h:334
_options
Options _optionsDefined in src/pacm/include/icy/pacm/packagemanager.h:335
Protected Methods
| Return | Name | Description |
|---|---|---|
void | onPackageInstallComplete | Callbacks. |
onPackageInstallComplete
void onPackageInstallComplete(InstallTask & task)Defined in src/pacm/include/icy/pacm/packagemanager.h:328
Callbacks.
