InstallTask
InstallTask
#include <icy/pacm/installtask.h>class InstallTaskDefined in src/pacm/include/icy/pacm/installtask.h:89
Inherits:
Runnable,Stateful< InstallationState >
Downloads, extracts, and finalizes a single package installation.
List of all members
| Name | Kind | Owner |
|---|---|---|
PackageManager | friend | Declared here |
InstallMonitor | friend | Declared here |
Progress | variable | Declared here |
Complete | variable | Declared here |
InstallTask | function | Declared here |
~InstallTask | function | Declared here |
InstallTask | function | Declared here |
operator= | function | Declared here |
InstallTask | function | Declared here |
operator= | function | Declared here |
start | function | Declared here |
cancel | function | Declared here |
doDownload | function | Declared here |
doExtract | function | Declared here |
doFinalize | function | Declared here |
setComplete | function | Declared here |
getRemoteAsset | function | Declared here |
local | function | Declared here |
remote | function | Declared here |
options | function | Declared here |
loop | function | Declared here |
valid | function | Declared here |
cancelled | function | Declared here |
failed | function | Declared here |
success | function | Declared here |
complete | function | Declared here |
progress | function | Declared here |
_mutex | variable | Declared here |
_runner | variable | Declared here |
_error | variable | Declared here |
_manager | variable | Declared here |
_local | variable | Declared here |
_remote | variable | Declared here |
_options | variable | Declared here |
_progress | variable | Declared here |
_downloading | variable | Declared here |
_dlconn | variable | Declared here |
_loop | variable | Declared here |
run | function | Declared here |
onStateChange | function | Declared here |
onDownloadProgress | function | Declared here |
onDownloadComplete | function | Declared here |
setProgress | function | Declared here |
Ptr | typedef | Declared here |
Runnable | function | Inherited from Runnable |
~Runnable | function | Inherited from Runnable |
run | function | Inherited from Runnable |
cancel | function | Inherited from Runnable |
cancelled | function | Inherited from Runnable |
exit | variable | Inherited from Runnable |
StateChange | variable | Inherited from Stateful |
Stateful | function | Inherited from Stateful |
~Stateful | function | Inherited from Stateful |
stateEquals | function | Inherited from Stateful |
stateBetween | function | Inherited from Stateful |
state | function | Inherited from Stateful |
state | function | Inherited from Stateful |
_state | variable | Inherited from Stateful |
beforeStateChange | function | Inherited from Stateful |
onStateChange | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
Inherited from Runnable
| Kind | Name | Description |
|---|---|---|
function | Runnable inline | |
function | ~Runnable virtual | Defaulted destructor. |
function | run virtual | The run method will be called by the asynchronous context. |
function | cancel virtual inline | Cancel the current task. The run() method should return ASAP. |
function | cancelled virtual const inline | Returns true when the task has been cancelled. |
variable | exit |
Inherited from Stateful
| Kind | Name | Description |
|---|---|---|
variable | StateChange | Signals when the state changes. |
function | Stateful inline | |
function | ~Stateful virtual inline | |
function | stateEquals virtual const inline | Returns true if the current state ID equals the given ID. |
function | stateBetween virtual const inline | Returns true if the current state ID is in the inclusive range [lid, rid]. |
function | state virtual inline | Returns a mutable reference to the current state. |
function | state virtual const inline | Returns a copy of the current state. |
variable | _state | |
function | beforeStateChange virtual inline | Override to handle pre state change logic. Return false to prevent state change. |
function | onStateChange virtual inline | Override to handle post state change logic. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
Friends
| Name | Description |
|---|---|
PackageManager | |
InstallMonitor |
PackageManager
friend class PackageManagerDefined in src/pacm/include/icy/pacm/installtask.h:202
InstallMonitor
friend class InstallMonitorDefined in src/pacm/include/icy/pacm/installtask.h:203
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 &)> ProgressDefined in src/pacm/include/icy/pacm/installtask.h:171
Signals on progress update [0-100].
Complete
Signal< void(InstallTask &)> CompleteDefined in src/pacm/include/icy/pacm/installtask.h:175
Signals on task completion for both success and failure cases.
Public Methods
| Return | Name | Description |
|---|---|---|
InstallTask | ||
InstallTask | Deleted constructor. | |
InstallTask | Deleted constructor. | |
void | start virtual | Validates options, resolves the install directory, and launches the background runner. |
void | cancel virtual override | 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 override | 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 = InstallOptions(), uv::Loop * loop = uv::defaultLoop())Defined in src/pacm/include/icy/pacm/installtask.h:101
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 &) = deleteDefined in src/pacm/include/icy/pacm/installtask.h:106
Deleted constructor.
InstallTask
InstallTask(InstallTask &&) = deleteDefined in src/pacm/include/icy/pacm/installtask.h:108
Deleted constructor.
start
virtual
virtual void start()Defined in src/pacm/include/icy/pacm/installtask.h:113
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 override
virtual void cancel(bool flag = true) overrideDefined in src/pacm/include/icy/pacm/installtask.h:116
Transitions the task to the Cancelled state.
Reimplements
doDownload
virtual
virtual void doDownload()Defined in src/pacm/include/icy/pacm/installtask.h:119
Downloads the package archive from the server.
doExtract
virtual
virtual void doExtract()Defined in src/pacm/include/icy/pacm/installtask.h:123
Extracts the downloaded package files to the intermediate directory.
doFinalize
virtual
virtual void doFinalize()Defined in src/pacm/include/icy/pacm/installtask.h:127
Moves extracted files from the intermediate directory to the installation directory.
setComplete
virtual
virtual void setComplete()Defined in src/pacm/include/icy/pacm/installtask.h:132
Called when the task completes either successfully or in error. This will trigger destruction.
getRemoteAsset
virtual const
virtual Package::Asset getRemoteAsset() constDefined in src/pacm/include/icy/pacm/installtask.h:136
Returns the remote asset selected by the current InstallOptions. Respects version and sdkVersion overrides; falls back to latestAsset().
local
virtual const
virtual LocalPackage * local() constDefined in src/pacm/include/icy/pacm/installtask.h:139
Returns a pointer to the local package record.
remote
virtual const
virtual RemotePackage * remote() constDefined in src/pacm/include/icy/pacm/installtask.h:142
Returns a pointer to the remote package record.
options
virtual const
virtual const InstallOptions & options() constDefined in src/pacm/include/icy/pacm/installtask.h:145
Returns a read-only view of the installation options for this task.
loop
virtual const
virtual uv::Loop * loop() constDefined in src/pacm/include/icy/pacm/installtask.h:148
Returns the libuv event loop used for async operations.
valid
virtual const
virtual bool valid() constDefined in src/pacm/include/icy/pacm/installtask.h:152
Returns true if the task is not in a Failed state and both local and remote (if set) packages are valid.
cancelled
virtual const override
virtual bool cancelled() const overrideDefined in src/pacm/include/icy/pacm/installtask.h:155
Returns true if the task is in the Cancelled state.
Reimplements
failed
virtual const
virtual bool failed() constDefined in src/pacm/include/icy/pacm/installtask.h:158
Returns true if the task is in the Failed state.
success
virtual const
virtual bool success() constDefined in src/pacm/include/icy/pacm/installtask.h:161
Returns true if the task is in the Installed (success) state.
complete
virtual const
virtual bool complete() constDefined in src/pacm/include/icy/pacm/installtask.h:165
Returns true if the task has reached a terminal state (Installed, Cancelled, or Failed).
progress
virtual const
virtual int progress() constDefined in src/pacm/include/icy/pacm/installtask.h:168
Returns 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 _mutexDefined in src/pacm/include/icy/pacm/installtask.h:189
_runner
Idler _runnerDefined in src/pacm/include/icy/pacm/installtask.h:191
_error
icy::Error _errorDefined in src/pacm/include/icy/pacm/installtask.h:192
_manager
PackageManager & _managerDefined in src/pacm/include/icy/pacm/installtask.h:193
_local
LocalPackage * _localDefined in src/pacm/include/icy/pacm/installtask.h:194
_remote
RemotePackage * _remoteDefined in src/pacm/include/icy/pacm/installtask.h:195
_options
InstallOptions _optionsDefined in src/pacm/include/icy/pacm/installtask.h:196
_progress
int _progressDefined in src/pacm/include/icy/pacm/installtask.h:197
_downloading
bool _downloadingDefined in src/pacm/include/icy/pacm/installtask.h:198
_dlconn
http::ClientConnection::Ptr _dlconnDefined in src/pacm/include/icy/pacm/installtask.h:199
_loop
uv::Loop * _loopDefined in src/pacm/include/icy/pacm/installtask.h:200
Protected Methods
| Return | Name | Description |
|---|---|---|
void | run virtual override | Called asynchronously by the thread to do the work. |
void | onStateChange override | |
void | onDownloadProgress virtual | |
void | onDownloadComplete virtual | |
void | setProgress virtual |
run
virtual override
virtual void run() overrideDefined in src/pacm/include/icy/pacm/installtask.h:179
Called asynchronously by the thread to do the work.
Reimplements
onStateChange
override
void onStateChange(InstallationState & state, const InstallationState & oldState) overrideDefined in src/pacm/include/icy/pacm/installtask.h:181
onDownloadProgress
virtual
virtual void onDownloadProgress(const double & progress)Defined in src/pacm/include/icy/pacm/installtask.h:183
onDownloadComplete
virtual
virtual void onDownloadComplete(const http::Response & response)Defined in src/pacm/include/icy/pacm/installtask.h:184
setProgress
virtual
virtual void setProgress(int value)Defined in src/pacm/include/icy/pacm/installtask.h:186
Public Types
| Name | Description |
|---|---|
Ptr |
Ptr
using Ptr = std::shared_ptr< InstallTask >