#include <icy/pacm/installtask.h>Inherits:
Runnable,Stateful< InstallationState >
Downloads, extracts, and finalizes a single package installation.
| Return | Name | Description |
|---|---|---|
Signal< void(InstallTask &, int &)> | Progress | Signals on progress update [0-100]. |
Signal< void(InstallTask &)> | Complete | Signals on task completion for both success and failure cases. |
Signal< void(InstallTask &, int &)> ProgressSignals on progress update [0-100].
Signal< void(InstallTask &)> CompleteSignals on task completion for both success and failure cases.
| Return | Name | Description |
|---|---|---|
InstallTask | #### Parameters | |
InstallTask | Deleted constructor. | |
InstallTask | Deleted constructor. | |
void | start virtual | Validates options, resolves the install directory, and launches the background runner. |
void | cancel virtual | Transitions the task to the Cancelled state. |
void | doDownload virtual | Downloads the package archive from the server. |
void | doExtract virtual | Extracts the downloaded package files to the intermediate directory. |
void | doFinalize virtual | Moves extracted files from the intermediate directory to the installation directory. |
void | setComplete virtual | Called when the task completes either successfully or in error. This will trigger destruction. |
Package::Asset | getRemoteAsset virtual const | Returns the remote asset selected by the current InstallOptions. Respects version and sdkVersion overrides; falls back to latestAsset(). |
LocalPackage * | local virtual const | Returns a pointer to the local package record. |
RemotePackage * | remote virtual const | Returns a pointer to the remote package record. |
const InstallOptions & | options virtual const | Returns a read-only view of the installation options for this task. |
uv::Loop * | loop virtual const | Returns the libuv event loop used for async operations. |
bool | valid virtual const | Returns true if the task is not in a Failed state and both local and remote (if set) packages are valid. |
bool | cancelled virtual const | Returns true if the task is in the Cancelled state. |
bool | failed virtual const | Returns true if the task is in the Failed state. |
bool | success virtual const | Returns true if the task is in the Installed (success) state. |
bool | complete virtual const | Returns true if the task has reached a terminal state (Installed, Cancelled, or Failed). |
int | progress virtual const | Returns the current progress value in the range [0, 100]. |
InstallTask(PackageManager & manager, LocalPackage * local, RemotePackage * remote, const InstallOptions & options, uv::Loop * loop)manager Owning PackageManager instance.
local Local package record (must not be null).
remote Remote package record to install from (may be null for local-only ops).
options Version and path overrides for this installation.
loop libuv event loop to use for async HTTP downloads.
std::runtime_error if the task configuration is invalid.InstallTask(const InstallTask &) = deleteDeleted constructor.
InstallTask(InstallTask &&) = deleteDeleted constructor.
virtual
virtual void start()Validates options, resolves the install directory, and launches the background runner.
std::runtime_error if the requested version or SDK version asset is unavailable.virtual
virtual void cancel(bool flag)Transitions the task to the Cancelled state.
virtual
virtual void doDownload()Downloads the package archive from the server.
virtual
virtual void doExtract()Extracts the downloaded package files to the intermediate directory.
virtual
virtual void doFinalize()Moves extracted files from the intermediate directory to the installation directory.
virtual
virtual void setComplete()Called when the task completes either successfully or in error. This will trigger destruction.
virtual const
virtual Package::Asset getRemoteAsset() constReturns the remote asset selected by the current InstallOptions. Respects version and sdkVersion overrides; falls back to latestAsset().
virtual const
virtual LocalPackage * local() constReturns a pointer to the local package record.
virtual const
virtual RemotePackage * remote() constReturns a pointer to the remote package record.
virtual const
virtual const InstallOptions & options() constReturns a read-only view of the installation options for this task.
virtual const
virtual uv::Loop * loop() constReturns the libuv event loop used for async operations.
virtual const
virtual bool valid() constReturns true if the task is not in a Failed state and both local and remote (if set) packages are valid.
virtual const
virtual bool cancelled() constReturns true if the task is in the Cancelled state.
virtual const
virtual bool failed() constReturns true if the task is in the Failed state.
virtual const
virtual bool success() constReturns true if the task is in the Installed (success) state.
virtual const
virtual bool complete() constReturns true if the task has reached a terminal state (Installed, Cancelled, or Failed).
virtual const
virtual int progress() constReturns the current progress value in the range [0, 100].
| Return | Name | Description |
|---|---|---|
std::mutex | _mutex | |
Idler | _runner | |
icy::Error | _error | |
PackageManager & | _manager | |
LocalPackage * | _local | |
RemotePackage * | _remote | |
InstallOptions | _options | |
int | _progress | |
bool | _downloading | |
http::ClientConnection::Ptr | _dlconn | |
uv::Loop * | _loop |
std::mutex _mutexIdler _runnericy::Error _errorPackageManager & _managerLocalPackage * _localRemotePackage * _remoteInstallOptions _optionsint _progressbool _downloadinghttp::ClientConnection::Ptr _dlconnuv::Loop * _loop| Return | Name | Description |
|---|---|---|
void | run virtual | Called asynchronously by the thread to do the work. |
void | onStateChange | |
void | onDownloadProgress virtual | |
void | onDownloadComplete virtual | |
void | setProgress virtual |
virtual
virtual void run()Called asynchronously by the thread to do the work.
void onStateChange(InstallationState & state, const InstallationState & oldState)virtual
virtual void onDownloadProgress(const double & progress)virtual
virtual void onDownloadComplete(const http::Response & response)virtual
virtual void setProgress(int value)| Name | Description |
|---|---|
Ptr |
std::shared_ptr< InstallTask > Ptr()