InstallTask
InstallTask
#include <icy/pacm/installtask.h>Inherits:
Runnable,Stateful< InstallationState >
Downloads, extracts, and finalizes a single package installation.
Public Attributes
| 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. |
Progress
Signal< void(InstallTask &, int &)> ProgressSignals on progress update [0-100].
Complete
Signal< void(InstallTask &)> CompleteSignals on task completion for both success and failure cases.
Public Methods
| 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
InstallTask(PackageManager & manager, LocalPackage * local, RemotePackage * remote, const InstallOptions & options, uv::Loop * loop)Parameters
managerOwning PackageManager instance.localLocal package record (must not be null).remoteRemote package record to install from (may be null for local-only ops).optionsVersion and path overrides for this installation.looplibuv event loop to use for async HTTP downloads.
Exceptions
std::runtime_errorif the task configuration is invalid.
InstallTask
InstallTask(const InstallTask &) = deleteDeleted constructor.
InstallTask
InstallTask(InstallTask &&) = deleteDeleted constructor.
start
virtual
virtual void start()Validates options, resolves the install directory, and launches the background runner.
Exceptions
std::runtime_errorif the requested version or SDK version asset is unavailable.
cancel
virtual
virtual void cancel(bool flag)Transitions the task to the Cancelled state.
doDownload
virtual
virtual void doDownload()Downloads the package archive from the server.
doExtract
virtual
virtual void doExtract()Extracts the downloaded package files to the intermediate directory.
doFinalize
virtual
virtual void doFinalize()Moves extracted files from the intermediate directory to the installation directory.
setComplete
virtual
virtual void setComplete()Called when the task completes either successfully or in error. This will trigger destruction.
getRemoteAsset
virtual const
virtual Package::Asset getRemoteAsset() constReturns the remote asset selected by the current InstallOptions. Respects version and sdkVersion overrides; falls back to latestAsset().
local
virtual const
virtual LocalPackage * local() constReturns a pointer to the local package record.
remote
virtual const
virtual RemotePackage * remote() constReturns a pointer to the remote package record.
options
virtual const
virtual const InstallOptions & options() constReturns a read-only view of the installation options for this task.
loop
virtual const
virtual uv::Loop * loop() constReturns the libuv event loop used for async operations.
valid
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.
cancelled
virtual const
virtual bool cancelled() constReturns true if the task is in the Cancelled state.
failed
virtual const
virtual bool failed() constReturns true if the task is in the Failed state.
success
virtual const
virtual bool success() constReturns true if the task is in the Installed (success) state.
complete
virtual const
virtual bool complete() constReturns true if the task has reached a terminal state (Installed, Cancelled, or Failed).
progress
virtual const
virtual int progress() constReturns the current progress value in the range [0, 100].
Protected Attributes
| 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 |
_mutex
std::mutex _mutex_runner
Idler _runner_error
icy::Error _error_manager
PackageManager & _manager_local
LocalPackage * _local_remote
RemotePackage * _remote_options
InstallOptions _options_progress
int _progress_downloading
bool _downloading_dlconn
http::ClientConnection::Ptr _dlconn_loop
uv::Loop * _loopProtected Methods
| 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 |
run
virtual
virtual void run()Called asynchronously by the thread to do the work.
onStateChange
void onStateChange(InstallationState & state, const InstallationState & oldState)onDownloadProgress
virtual
virtual void onDownloadProgress(const double & progress)onDownloadComplete
virtual
virtual void onDownloadComplete(const http::Response & response)setProgress
virtual
virtual void setProgress(int value)Public Types
| Name | Description |
|---|---|
Ptr |
Ptr
std::shared_ptr< InstallTask > Ptr()