Pacm module

LocalPackage

[Package]({#ref structicy_1_1pacm_1_1Package #}) metadata for an installed package on the local filesystem.

LocalPackage

#include <icy/pacm/package.h>

Inherits: Package

Package metadata for an installed package on the local filesystem.

Public Methods

ReturnNameDescription
LocalPackageConstructs an empty local package.
LocalPackageConstructs a local package from an existing JSON value.
LocalPackageCreate the local package from the remote package reference with the following manipulations. 1) Add a local manifest element. 2) Remove asset mirror elements.
voidsetState virtualSet's the overall package state. Possible values are: Installing, Installed, Failed, Uninstalled. If the packages completes while still Installing, this means the package has yet to be finalized.
voidsetInstallState virtualSet's the package installation state. See InstallationState for possible values.
voidsetInstallDir virtualSet's the installation directory for this package.
voidsetInstalledAsset virtualSets the installed asset, once installed. This method also sets the version.
voidsetVersion virtualSets the current version of the local package. Installation must be complete.
voidsetVersionLock virtualLocks the package at the given version. Once set this package will not be updated past the given version. Pass an empty string to remove the lock.
voidsetSDKVersionLock virtualLocks the package at the given SDK version. Once set this package will only update to the most recent version with given SDK version. Pass an empty string to remove the lock.
std::stringversion virtual constReturns the installed package version.
std::stringstate virtual constReturns the current state of this package.
std::stringinstallState virtual constReturns the installation state of this package.
std::stringinstallDir virtual constReturns the installation directory for this package.
std::stringversionLock virtual constReturns the pinned version string, or empty if no lock is set.
std::stringsdkLockedVersion virtual constReturns the pinned SDK version string, or empty if no lock is set.
Assetasset virtualReturns the currently installed asset, if any. If none, the returned asset will be empty().
boolisInstalled virtual constReturns true or false depending on weather or not the package is installed successfully. False if package is in Failed state.
boolisFailed virtual constReturns true if the package state is "Failed".
Manifestmanifest virtualReturns the installation manifest.
boolverifyInstallManifest virtual
std::stringgetInstalledFilePath virtualReturns the full full path of the installed file. Thrown an exception if the install directory is unset.
json::Value &errors virtualReturns a reference to the JSON array of accumulated error messages.
voidaddError virtualAppends message to the errors array.
std::stringlastError virtual constReturns the most recently added error message, or empty if none.
voidclearErrors virtualClears all recorded error messages.
boolvalid virtual constReturns true if id, name and type are all non-empty.

LocalPackage

LocalPackage()

Constructs an empty local package.


LocalPackage

LocalPackage(const json::Value & src)

Constructs a local package from an existing JSON value.

Parameters

  • src JSON object containing local package fields.

LocalPackage

LocalPackage(const RemotePackage & src)

Create the local package from the remote package reference with the following manipulations. 1) Add a local manifest element. 2) Remove asset mirror elements.


setState

virtual

virtual void setState(const std::string & state)

Set's the overall package state. Possible values are: Installing, Installed, Failed, Uninstalled. If the packages completes while still Installing, this means the package has yet to be finalized.


setInstallState

virtual

virtual void setInstallState(const std::string & state)

Set's the package installation state. See InstallationState for possible values.


setInstallDir

virtual

virtual void setInstallDir(const std::string & dir)

Set's the installation directory for this package.


setInstalledAsset

virtual

virtual void setInstalledAsset(const Package::Asset & installedRemoteAsset)

Sets the installed asset, once installed. This method also sets the version.


setVersion

virtual

virtual void setVersion(const std::string & version)

Sets the current version of the local package. Installation must be complete.


setVersionLock

virtual

virtual void setVersionLock(const std::string & version)

Locks the package at the given version. Once set this package will not be updated past the given version. Pass an empty string to remove the lock.


setSDKVersionLock

virtual

virtual void setSDKVersionLock(const std::string & version)

Locks the package at the given SDK version. Once set this package will only update to the most recent version with given SDK version. Pass an empty string to remove the lock.


version

virtual const

virtual std::string version() const

Returns the installed package version.


state

virtual const

virtual std::string state() const

Returns the current state of this package.


installState

virtual const

virtual std::string installState() const

Returns the installation state of this package.


installDir

virtual const

virtual std::string installDir() const

Returns the installation directory for this package.


versionLock

virtual const

virtual std::string versionLock() const

Returns the pinned version string, or empty if no lock is set.


sdkLockedVersion

virtual const

virtual std::string sdkLockedVersion() const

Returns the pinned SDK version string, or empty if no lock is set.


asset

virtual

virtual Asset asset()

Returns the currently installed asset, if any. If none, the returned asset will be empty().


isInstalled

virtual const

virtual bool isInstalled() const

Returns true or false depending on weather or not the package is installed successfully. False if package is in Failed state.


isFailed

virtual const

virtual bool isFailed() const

Returns true if the package state is "Failed".


manifest

virtual

virtual Manifest manifest()

Returns the installation manifest.


verifyInstallManifest

virtual

virtual bool verifyInstallManifest(bool allowEmpty)

getInstalledFilePath

virtual

virtual std::string getInstalledFilePath(const std::string & fileName, bool whiny)

Returns the full full path of the installed file. Thrown an exception if the install directory is unset.


errors

virtual

virtual json::Value & errors()

Returns a reference to the JSON array of accumulated error messages.


addError

virtual

virtual void addError(const std::string & message)

Appends message to the errors array.

Parameters

  • message Error description to record.

lastError

virtual const

virtual std::string lastError() const

Returns the most recently added error message, or empty if none.


clearErrors

virtual

virtual void clearErrors()

Clears all recorded error messages.


valid

virtual const

virtual bool valid() const

Returns true if id, name and type are all non-empty.