# PackageManager

<a id="packagemanager-1"></a>

# PackageManager

```cpp
#include <icy/pacm/packagemanager.h>

class PackageManager
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:62](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L62)

Loads package manifests and coordinates install, update, and uninstall workflows.

## Public Attributes

| Return | Name | Description |
|--------|------|-------------|
| [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void(const [`http::Response`](https://auscaster.com/icey/docs/api-reference/icy-http-Response.md#response-3) &)> | [`RemotePackageResponse`](#remotepackageresponse)  | Events. |
| [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void([`LocalPackage`](https://auscaster.com/icey/docs/api-reference/icy-pacm-LocalPackage.md#localpackage) &)> | [`PackageUninstalled`](#packageuninstalled)  | Signals when a package is uninstalled. |
| [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void([`InstallTask`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) &)> | [`InstallTaskCreated`](#installtaskcreated)  | Signals when an installation task is created, before it is started. |
| [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void(const [`InstallTask`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) &)> | [`InstallTaskComplete`](#installtaskcomplete)  | Signals when a package installation tasks completes, either successfully or in error. |

---

<a id="remotepackageresponse"></a>

### RemotePackageResponse

```cpp
Signal< void(const http::Response &)> RemotePackageResponse
```

Type: [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void(const [`http::Response`](https://auscaster.com/icey/docs/api-reference/icy-http-Response.md#response-3) &)>

[Defined in src/pacm/include/icy/pacm/packagemanager.h:311](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L311)

Events.

Signals when the remote package list have been downloaded from the server.

---

<a id="packageuninstalled"></a>

### PackageUninstalled

```cpp
Signal< void(LocalPackage &)> PackageUninstalled
```

Type: [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void([`LocalPackage`](https://auscaster.com/icey/docs/api-reference/icy-pacm-LocalPackage.md#localpackage) &)>

[Defined in src/pacm/include/icy/pacm/packagemanager.h:314](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L314)

Signals when a package is uninstalled.

---

<a id="installtaskcreated"></a>

### InstallTaskCreated

```cpp
Signal< void(InstallTask &)> InstallTaskCreated
```

Type: [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void([`InstallTask`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) &)>

[Defined in src/pacm/include/icy/pacm/packagemanager.h:318](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L318)

Signals when an installation task is created, before it is started.

---

<a id="installtaskcomplete"></a>

### InstallTaskComplete

```cpp
Signal< void(const InstallTask &)> InstallTaskComplete
```

Type: [`Signal`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)< void(const [`InstallTask`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) &)>

[Defined in src/pacm/include/icy/pacm/packagemanager.h:322](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L322)

Signals when a package installation tasks completes, either successfully or in error.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`PackageManager`](#packagemanager-2)  |  |
|  | [`~PackageManager`](#packagemanager-3) `virtual` `noexcept` |  |
|  | [`PackageManager`](#packagemanager-4)  | Deleted constructor. |
| [`PackageManager`](#packagemanager-1) & | [`operator=`](#operator-219)  | Deleted assignment operator. |
|  | [`PackageManager`](#packagemanager-5)  | Deleted constructor. |
| [`PackageManager`](#packagemanager-1) & | [`operator=`](#operator-220)  | Deleted assignment operator. |
| `void` | [`initialize`](#initialize) `virtual` | Initialization Methods. |
| `void` | [`uninitialize`](#uninitialize) `virtual` | Releases resources and cancels any in-progress tasks. |
| `bool` | [`initialized`](#initialized-3) `virtual` `const` | Returns true if [initialize()](#initialize) has been called successfully. |
| `void` | [`createDirectories`](#createdirectories) `virtual` | Creates the package manager directory structure if it does not already exist. |
| `void` | [`queryRemotePackages`](#queryremotepackages) `virtual` | Queries the server for a list of available packages. |
| `void` | [`loadLocalPackages`](#loadlocalpackages) `virtual` | Loads all local package manifests from file system. Clears all in memory package manifests. |
| `void` | [`loadLocalPackages`](#loadlocalpackages-1) `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`](#savelocalpackages) `virtual` | Saves all local package manifests to the data directory. |
| `bool` | [`saveLocalPackage`](#savelocalpackage) `virtual` | Saves the local package manifest to the file system. |
| `void` | [`parseRemotePackages`](#parseremotepackages) `virtual` | Parse the remote packages from the given JSON data string. |
| [`InstallTask::Ptr`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#ptr-19) | [`installPackage`](#installpackage) `virtual` | [Package](https://auscaster.com/icey/docs/api-reference/icy-pacm-Package.md#package) Installation Methods. |
| `bool` | [`installPackages`](#installpackages) `virtual` | Installs multiple packages. The same options will be passed to each task. If a [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor) instance was passed in the tasks will need to be started, otherwise they will be auto-started. The [PackageManager](#packagemanager-1) does not take ownership of the [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor). |
| [`InstallTask::Ptr`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#ptr-19) | [`updatePackage`](#updatepackage) `virtual` | Updates a single package. Throws an exception if the package does not exist. The returned [InstallTask](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) must be started. |
| `bool` | [`updatePackages`](#updatepackages) `virtual` | Updates multiple packages. Throws an exception if the package does not exist. If a [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor) instance was passed in the tasks will need to be started, otherwise they will be auto-started. The [PackageManager](#packagemanager-1) does not take ownership of the [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor). |
| `bool` | [`updateAllPackages`](#updateallpackages) `virtual` | Updates all installed packages. |
| `bool` | [`uninstallPackages`](#uninstallpackages) `virtual` | Uninstalls multiple packages. |
| `bool` | [`uninstallPackage`](#uninstallpackage) `virtual` | Uninstalls a single package. |
| `bool` | [`hasUnfinalizedPackages`](#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`](#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`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#ptr-19) | [`getInstallTask`](#getinstalltask) `virtual` `const` | [Task](https://auscaster.com/icey/docs/api-reference/icy-Task.md#task) Helper Methods. |
| [`InstallTaskPtrVec`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#installtaskptrvec) | [`tasks`](#tasks-1) `virtual` `const` | Returns a list of all tasks. |
| `void` | [`cancelAllTasks`](#cancelalltasks) `virtual` | Aborts all package installation tasks. All tasks must be aborted before clearing local or remote manifests. |
| [`PackagePairVec`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#packagepairvec) | [`getPackagePairs`](#getpackagepairs) `virtual` `const` | [Package](https://auscaster.com/icey/docs/api-reference/icy-pacm-Package.md#package) Helper Methods. |
| [`PackagePairVec`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#packagepairvec) | [`getUpdatablePackagePairs`](#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`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackagePair.md#packagepair) | [`getPackagePair`](#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`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackagePair.md#packagepair) | [`getOrCreatePackagePair`](#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`](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#ptr-19) | [`createInstallTask`](#createinstalltask) `virtual` | Creates a package installation task for the given pair. |
| `std::string` | [`installedPackageVersion`](#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`](https://auscaster.com/icey/docs/api-reference/icy-pacm-Package-Asset.md#asset-1) | [`getLatestInstallableAsset`](#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`](#hasavailableupdates) `virtual` `const` | Returns true if there are updates available for this package, false otherwise. |
| `void` | [`clearCache`](#clearcache)  | File Helper Methods. |
| `bool` | [`clearPackageCache`](#clearpackagecache)  | Clears a package archive from the local cache. |
| `bool` | [`clearCacheFile`](#clearcachefile)  | Clears a file from the local cache. |
| `bool` | [`hasCachedFile`](#hascachedfile)  | Checks if a package archive exists in the local cache. |
| `bool` | [`isSupportedFileType`](#issupportedfiletype)  | Checks if the file type is a supported package archive. |
| `std::string` | [`getCacheFilePath`](#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`](#getpackagedatadir)  | Returns the package data directory for the given package ID. |
| [`Options`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackageManager-Options.md#options-7) & | [`mutableOptions`](#mutableoptions) `virtual` | Accessors. |
| const [`Options`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackageManager-Options.md#options-7) & | [`options`](#options-6) `virtual` `const` | Returns a read-only view of the current options. |
| [`RemotePackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#remotepackagestore) & | [`remotePackages`](#remotepackages) `virtual` | Returns a reference to the in-memory remote package store. |
| [`LocalPackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#localpackagestore) & | [`localPackages`](#localpackages) `virtual` | Returns a reference to the in-memory local package store. |

---

<a id="packagemanager-2"></a>

### PackageManager

```cpp
PackageManager(const Options & options = Options())
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:99](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L99)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `options` | const [`Options`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackageManager-Options.md#options-7) & | [Configuration](https://auscaster.com/icey/docs/api-reference/icy-Configuration.md#configuration) for directories, endpoints, and credentials. |

---

<a id="packagemanager-3"></a>

### ~PackageManager

`virtual` `noexcept`

```cpp
virtual ~PackageManager() noexcept
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:100](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L100)

---

<a id="packagemanager-4"></a>

### PackageManager

```cpp
PackageManager(const PackageManager &) = delete
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:102](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L102)

Deleted constructor.

---

<a id="operator-219"></a>

### operator=

```cpp
PackageManager & operator=(const PackageManager &) = delete
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:103](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L103)

Deleted assignment operator.

---

<a id="packagemanager-5"></a>

### PackageManager

```cpp
PackageManager(PackageManager &&) = delete
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:104](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L104)

Deleted constructor.

---

<a id="operator-220"></a>

### operator=

```cpp
PackageManager & operator=(PackageManager &&) = delete
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:105](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L105)

Deleted assignment operator.

---

<a id="initialize"></a>

### initialize

`virtual`

```cpp
virtual void initialize()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:112](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L112)

Initialization Methods.

Initializes the package manager: creates directories, loads local manifests, and queries the remote package index.

---

<a id="uninitialize"></a>

### uninitialize

`virtual`

```cpp
virtual void uninitialize()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:115](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L115)

Releases resources and cancels any in-progress tasks.

---

<a id="initialized-3"></a>

### initialized

`virtual` `const`

```cpp
virtual bool initialized() const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:118](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L118)

Returns true if [initialize()](#initialize) has been called successfully.

---

<a id="createdirectories"></a>

### createDirectories

`virtual`

```cpp
virtual void createDirectories()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:122](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L122)

Creates the package manager directory structure if it does not already exist.

---

<a id="queryremotepackages"></a>

### queryRemotePackages

`virtual`

```cpp
virtual void queryRemotePackages()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:125](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L125)

Queries the server for a list of available packages.

---

<a id="loadlocalpackages"></a>

### loadLocalPackages

`virtual`

```cpp
virtual void loadLocalPackages()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:129](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L129)

Loads all local package manifests from file system. Clears all in memory package manifests.

---

<a id="loadlocalpackages-1"></a>

### loadLocalPackages

`virtual`

```cpp
virtual void loadLocalPackages(const std::string & dir)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:135](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L135)

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.

---

<a id="savelocalpackages"></a>

### saveLocalPackages

`virtual`

```cpp
virtual bool saveLocalPackages(bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:140](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L140)

Saves all local package manifests to the data directory. 
#### Returns
true on success.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `whiny` | `bool` | If true, re-throws on write error; otherwise returns false. |

---

<a id="savelocalpackage"></a>

### saveLocalPackage

`virtual`

```cpp
virtual bool saveLocalPackage(LocalPackage & package, bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:143](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L143)

Saves the local package manifest to the file system.

---

<a id="parseremotepackages"></a>

### parseRemotePackages

`virtual`

```cpp
virtual void parseRemotePackages(const std::string & data)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:146](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L146)

Parse the remote packages from the given JSON data string.

---

<a id="installpackage"></a>

### installPackage

`virtual`

```cpp
virtual InstallTask::Ptr installPackage(const std::string & name, const InstallOptions & options = InstallOptions())
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:156](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L156)

[Package](https://auscaster.com/icey/docs/api-reference/icy-pacm-Package.md#package) Installation Methods.

Installs a single package. The returned [InstallTask](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#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.

---

<a id="installpackages"></a>

### installPackages

`virtual`

```cpp
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](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L165)

Installs multiple packages. The same options will be passed to each task. If a [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor) instance was passed in the tasks will need to be started, otherwise they will be auto-started. The [PackageManager](#packagemanager-1) does not take ownership of the [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor).

---

<a id="updatepackage"></a>

### updatePackage

`virtual`

```cpp
virtual InstallTask::Ptr updatePackage(const std::string & name, const InstallOptions & options = InstallOptions())
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:173](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L173)

Updates a single package. Throws an exception if the package does not exist. The returned [InstallTask](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallTask.md#installtask) must be started.

---

<a id="updatepackages"></a>

### updatePackages

`virtual`

```cpp
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](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L182)

Updates multiple packages. Throws an exception if the package does not exist. If a [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor) instance was passed in the tasks will need to be started, otherwise they will be auto-started. The [PackageManager](#packagemanager-1) does not take ownership of the [InstallMonitor](https://auscaster.com/icey/docs/api-reference/icy-pacm-InstallMonitor.md#installmonitor).

---

<a id="updateallpackages"></a>

### updateAllPackages

`virtual`

```cpp
virtual bool updateAllPackages(bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:187](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L187)

Updates all installed packages.

---

<a id="uninstallpackages"></a>

### uninstallPackages

`virtual`

```cpp
virtual bool uninstallPackages(const StringVec & ids, bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:190](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L190)

Uninstalls multiple packages.

---

<a id="uninstallpackage"></a>

### uninstallPackage

`virtual`

```cpp
virtual bool uninstallPackage(const std::string & id, bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:193](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L193)

Uninstalls a single package.

---

<a id="hasunfinalizedpackages"></a>

### hasUnfinalizedPackages

`virtual`

```cpp
virtual bool hasUnfinalizedPackages()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:198](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L198)

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.

---

<a id="finalizeinstallations"></a>

### finalizeInstallations

`virtual`

```cpp
virtual bool finalizeInstallations(bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:204](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L204)

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.

---

<a id="getinstalltask"></a>

### getInstallTask

`virtual` `const`

```cpp
virtual InstallTask::Ptr getInstallTask(const std::string & id) const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:210](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L210)

[Task](https://auscaster.com/icey/docs/api-reference/icy-Task.md#task) Helper Methods.

Gets the install task for the given package ID.

---

<a id="tasks-1"></a>

### tasks

`virtual` `const`

```cpp
virtual InstallTaskPtrVec tasks() const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:213](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L213)

Returns a list of all tasks.

---

<a id="cancelalltasks"></a>

### cancelAllTasks

`virtual`

```cpp
virtual void cancelAllTasks()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:217](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L217)

Aborts all package installation tasks. All tasks must be aborted before clearing local or remote manifests.

---

<a id="getpackagepairs"></a>

### getPackagePairs

`virtual` `const`

```cpp
virtual PackagePairVec getPackagePairs() const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:224](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L224)

[Package](https://auscaster.com/icey/docs/api-reference/icy-pacm-Package.md#package) Helper Methods.

Returns all package pairs, valid or invalid. Some pairs may not have both local and remote package pointers.

---

<a id="getupdatablepackagepairs"></a>

### getUpdatablePackagePairs

`virtual` `const`

```cpp
virtual PackagePairVec getUpdatablePackagePairs() const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:229](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L229)

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.

---

<a id="getpackagepair"></a>

### getPackagePair

`virtual` `const`

```cpp
virtual PackagePair getPackagePair(const std::string & id, bool whiny = false) const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:234](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L234)

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.

---

<a id="getorcreatepackagepair"></a>

### getOrCreatePackagePair

`virtual`

```cpp
virtual PackagePair getOrCreatePackagePair(const std::string & id)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:242](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L242)

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.

---

<a id="createinstalltask"></a>

### createInstallTask

`virtual`

```cpp
virtual InstallTask::Ptr createInstallTask(PackagePair & pair, const InstallOptions & options = InstallOptions())
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:245](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L245)

Creates a package installation task for the given pair.

---

<a id="installedpackageversion"></a>

### installedPackageVersion

`virtual` `const`

```cpp
virtual std::string installedPackageVersion(const std::string & id) const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:251](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L251)

Returns the version number of an installed package. Exceptions will be thrown if the package does not exist, or is not fully installed.

---

<a id="getlatestinstallableasset"></a>

### getLatestInstallableAsset

`virtual` `const`

```cpp
virtual Package::Asset getLatestInstallableAsset(const PackagePair & pair, const InstallOptions & options = InstallOptions()) const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:256](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L256)

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.

---

<a id="hasavailableupdates"></a>

### hasAvailableUpdates

`virtual` `const`

```cpp
virtual bool hasAvailableUpdates(const PackagePair & pair) const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:262](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L262)

Returns true if there are updates available for this package, false otherwise.

---

<a id="clearcache"></a>

### clearCache

```cpp
void clearCache()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:268](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L268)

File Helper Methods.

Clears all files in the cache directory.

---

<a id="clearpackagecache"></a>

### clearPackageCache

```cpp
bool clearPackageCache(LocalPackage & package)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:271](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L271)

Clears a package archive from the local cache.

---

<a id="clearcachefile"></a>

### clearCacheFile

```cpp
bool clearCacheFile(std::string_view fileName, bool whiny = false)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:274](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L274)

Clears a file from the local cache.

---

<a id="hascachedfile"></a>

### hasCachedFile

```cpp
bool hasCachedFile(Package::Asset & asset)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:277](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L277)

Checks if a package archive exists in the local cache.

---

<a id="issupportedfiletype"></a>

### isSupportedFileType

```cpp
bool isSupportedFileType(std::string_view fileName)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:280](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L280)

Checks if the file type is a supported package archive.

---

<a id="getcachefilepath"></a>

### getCacheFilePath

```cpp
std::string getCacheFilePath(std::string_view fileName)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:284](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L284)

Returns the full path of the cached file if it exists, or an empty path if the file doesn't exist.

---

<a id="getpackagedatadir"></a>

### getPackageDataDir

```cpp
std::string getPackageDataDir(std::string_view id)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:288](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L288)

Returns the package data directory for the given package ID.

---

<a id="mutableoptions"></a>

### mutableOptions

`virtual`

```cpp
virtual Options & mutableOptions()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:295](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L295)

Accessors.

Returns the mutable startup configuration for this manager. Callers should finish edits before [initialize()](#initialize).

---

<a id="options-6"></a>

### options

`virtual` `const`

```cpp
virtual const Options & options() const
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:298](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L298)

Returns a read-only view of the current options.

---

<a id="remotepackages"></a>

### remotePackages

`virtual`

```cpp
virtual RemotePackageStore & remotePackages()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:301](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L301)

Returns a reference to the in-memory remote package store.

---

<a id="localpackages"></a>

### localPackages

`virtual`

```cpp
virtual LocalPackageStore & localPackages()
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:304](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L304)

Returns a reference to the in-memory local package store.

## Protected Attributes

| Return | Name | Description |
|--------|------|-------------|
| `std::mutex` | [`_mutex`](#_mutex-19)  |  |
| [`LocalPackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#localpackagestore) | [`_localPackages`](#_localpackages)  |  |
| [`RemotePackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#remotepackagestore) | [`_remotePackages`](#_remotepackages)  |  |
| [`InstallTaskPtrVec`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#installtaskptrvec) | [`_tasks`](#_tasks-2)  |  |
| [`Options`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackageManager-Options.md#options-7) | [`_options`](#_options-2)  |  |

---

<a id="_mutex-19"></a>

### _mutex

```cpp
std::mutex _mutex
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:331](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L331)

---

<a id="_localpackages"></a>

### _localPackages

```cpp
LocalPackageStore _localPackages
```

Type: [`LocalPackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#localpackagestore)

[Defined in src/pacm/include/icy/pacm/packagemanager.h:332](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L332)

---

<a id="_remotepackages"></a>

### _remotePackages

```cpp
RemotePackageStore _remotePackages
```

Type: [`RemotePackageStore`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#remotepackagestore)

[Defined in src/pacm/include/icy/pacm/packagemanager.h:333](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L333)

---

<a id="_tasks-2"></a>

### _tasks

```cpp
InstallTaskPtrVec _tasks
```

Type: [`InstallTaskPtrVec`](https://auscaster.com/icey/docs/api-reference/icy-pacm.md#installtaskptrvec)

[Defined in src/pacm/include/icy/pacm/packagemanager.h:334](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L334)

---

<a id="_options-2"></a>

### _options

```cpp
Options _options
```

Type: [`Options`](https://auscaster.com/icey/docs/api-reference/icy-pacm-PackageManager-Options.md#options-7)

[Defined in src/pacm/include/icy/pacm/packagemanager.h:335](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L335)

## Protected Methods

| Return | Name | Description |
|--------|------|-------------|
| `void` | [`onPackageInstallComplete`](#onpackageinstallcomplete)  | Callbacks. |

---

<a id="onpackageinstallcomplete"></a>

### onPackageInstallComplete

```cpp
void onPackageInstallComplete(InstallTask & task)
```

[Defined in src/pacm/include/icy/pacm/packagemanager.h:328](https://github.com/auscaster/icey/blob/main/src/pacm/include/icy/pacm/packagemanager.h#L328)

Callbacks.
