Module pacm

Summary

Members Descriptions
namespacescy::pacm

namespace scy::pacm

Summary

Members Descriptions
classscy::pacm::InstallMonitor
classscy::pacm::InstallTask This class implements the package installation procedure.
classscy::pacm::PackageManager
structscy::pacm::InstallationState
structscy::pacm::InstallOptions Package installation options.
structscy::pacm::LocalPackage
structscy::pacm::Package
structscy::pacm::PackagePair
structscy::pacm::RemotePackage

class scy::pacm::InstallMonitor

Summary

Members Descriptions
public`Signal3< InstallTask &, const InstallationState &, const InstallationState`& > InstallStateChange Proxies state change events from managed packages.
public`Signal< LocalPackage`& > InstallComplete Signals when a managed install task completes.
publicSignal< int & > Progress Signals on overall progress update [0-100].
publicSignal< LocalPackageVec & > Complete Signals on all tasks complete.
public InstallMonitor()
public virtual ~InstallMonitor()
public virtual void addTask(InstallTask::Ptr task) Adds a task to monitor.
public virtual void startAll() Starts all monitored tasks.
public virtual void cancelAll() Cancels all monitored tasks.
public virtual bool isComplete() const
public virtual InstallTaskPtrVec tasks() const Returns the list of monitored package tasks.
public virtual LocalPackageVec packages() const Returns the list of monitored packages.
protected mutableMutex_mutex
protected InstallTaskPtrVec _tasks
protected LocalPackageVec _packages
protected int _progress
protected virtual void onInstallStateChange(void * sender,InstallationState& state,constInstallationState& oldState)
protected virtual void onInstallComplete(void * sender)
protected virtual void setProgress(int value)

Members

public`Signal3< InstallTask &, const InstallationState &, const InstallationState`& > InstallStateChange

Proxies state change events from managed packages.

public`Signal< LocalPackage`& > InstallComplete

Signals when a managed install task completes.

publicSignal< int & > Progress

Signals on overall progress update [0-100].

publicSignal< LocalPackageVec & > Complete

Signals on all tasks complete.

public InstallMonitor()

public virtual ~InstallMonitor()

public virtual void addTask(InstallTask::Ptr task)

Adds a task to monitor.

public virtual void startAll()

Starts all monitored tasks.

public virtual void cancelAll()

Cancels all monitored tasks.

public virtual bool isComplete() const

Returns true if all install tasks have completed, either successfully or unsuccessfully.

public virtual InstallTaskPtrVec tasks() const

Returns the list of monitored package tasks.

public virtual LocalPackageVec packages() const

Returns the list of monitored packages.

protected mutableMutex_mutex

protected InstallTaskPtrVec _tasks

protected LocalPackageVec _packages

protected int _progress

protected virtual void onInstallStateChange(void * sender,InstallationState& state,constInstallationState& oldState)

protected virtual void onInstallComplete(void * sender)

protected virtual void setProgress(int value)

class scy::pacm::InstallTask

class scy::pacm::InstallTask
  : public scy::async::Runnable
  : public scy::Stateful< InstallationState >

This class implements the package installation procedure.

Summary

Members Descriptions
publicSignal< int & > Progress Signals on progress update [0-100].
publicNullSignalComplete
public InstallTask(PackageManager& manager,LocalPackage* local,RemotePackage* remote,constInstallOptions& options,uv::Loop * loop)
public virtual ~InstallTask()
public virtual void start()
public virtual void cancel()
public virtual void doDownload() Downloads the package archive from the server.
public virtual void doExtract()
public virtual void doFinalize()
public virtual void setComplete()
public virtualPackage::AssetgetRemoteAsset() const
public virtualLocalPackage* local() const
public virtualRemotePackage* remote() const
public virtualInstallOptions& options()
public virtual uv::Loop * loop() const
public virtual bool valid() const
public virtual bool cancelled() const True when the task has been cancelled.
public virtual bool failed() const
public virtual bool success() const
public virtual bool complete() const
public virtual int progress() const
protected mutableMutex_mutex
protectedIdler_runner
protectedPackageManager& _manager
protectedLocalPackage* _local
protectedRemotePackage* _remote
protectedInstallOptions_options
protected int _progress
protected bool _downloading
protected http::ClientConnection::Ptr _dlconn
protected uv::Loop * _loop
protected virtual void run()
protected virtual void onStateChange(InstallationState& state,constInstallationState& oldState)
protected virtual void onDownloadProgress(void * sender,const double & progress)
protected virtual void onDownloadComplete(void * sender,consthttp::Response& response)
protected virtual void setProgress(int value)

Members

publicSignal< int & > Progress

Signals on progress update [0-100].

publicNullSignalComplete

Signals on task completion for both success and failure cases.

public InstallTask(PackageManager& manager,LocalPackage* local,RemotePackage* remote,constInstallOptions& options,uv::Loop * loop)

public virtual ~InstallTask()

public virtual void start()

public virtual void cancel()

public virtual void doDownload()

Downloads the package archive from the server.

public virtual void doExtract()

Extracts the downloaded package files to the intermediate directory.

public virtual void doFinalize()

Moves extracted files from the intermediate directory to the installation directory.

public virtual void setComplete()

Called when the task completes either successfully or in error. This will trigger destruction.

public virtualPackage::AssetgetRemoteAsset() const

public virtualLocalPackage* local() const

public virtualRemotePackage* remote() const

public virtualInstallOptions& options()

public virtual uv::Loop * loop() const

public virtual bool valid() const

public virtual bool cancelled() const

True when the task has been cancelled.

public virtual bool failed() const

public virtual bool success() const

public virtual bool complete() const

public virtual int progress() const

protected mutableMutex_mutex

protectedIdler_runner

protectedPackageManager& _manager

protectedLocalPackage* _local

protectedRemotePackage* _remote

protectedInstallOptions_options

protected int _progress

protected bool _downloading

protected http::ClientConnection::Ptr _dlconn

protected uv::Loop * _loop

protected virtual void run()

Called asynchronously by the thread to do the work.

protected virtual void onStateChange(InstallationState& state,constInstallationState& oldState)

protected virtual void onDownloadProgress(void * sender,const double & progress)

protected virtual void onDownloadComplete(void * sender,consthttp::Response& response)

protected virtual void setProgress(int value)

class scy::pacm::PackageManager

The Package Manager provides an interface for managing, installing, updating and uninstalling Pacm packages.

Summary

Members Descriptions
public`Signal< const http::Response`& > RemotePackageResponse
public`Signal< LocalPackage`& > PackageUninstalled Signals when a package is uninstalled.
public`Signal< InstallTask`& > InstallTaskCreated
public`Signal< const InstallTask`& > InstallTaskComplete
public PackageManager(constOptions& options)
public virtual ~PackageManager()
public virtual void initialize()
public virtual void uninitialize()
public virtual bool initialized() const
public virtual void createDirectories()
public virtual void queryRemotePackages() Queries the server for a list of available packages.
public virtual void loadLocalPackages()
public virtual void loadLocalPackages(const std::string & dir)
public virtual bool saveLocalPackages(bool whiny)
public virtual bool saveLocalPackage(LocalPackage& package,bool whiny) Saves the local package manifest to the file system.
public virtual InstallTask::Ptr installPackage(const std::string & name,constInstallOptions& options)
public virtual bool installPackages(const StringVec & ids,constInstallOptions& options,InstallMonitor* monitor,bool whiny)
public virtual InstallTask::Ptr updatePackage(const std::string & name,constInstallOptions& options)
public virtual bool updatePackages(const StringVec & ids,constInstallOptions& options,InstallMonitor* monitor,bool whiny)
public virtual bool updateAllPackages(bool whiny) Updates all installed packages.
public virtual bool uninstallPackages(const StringVec & ids,bool whiny) Uninstalls multiple packages.
public virtual bool uninstallPackage(const std::string & id,bool whiny) Uninstalls a single package.
public virtual bool hasUnfinalizedPackages()
public virtual bool finalizeInstallations(bool whiny)
public virtual InstallTask::Ptr getInstallTask(const std::string & id) const Gets the install task for the given package ID.
public virtual InstallTaskPtrVec tasks() const Returns a list of all tasks.
public virtual void cancelAllTasks()
public virtual PackagePairVec getPackagePairs() const
public virtual PackagePairVec getUpdatablePackagePairs() const
public virtualPackagePairgetPackagePair(const std::string & id,bool whiny) const
public virtualPackagePairgetOrCreatePackagePair(const std::string & id)
public virtual InstallTask::Ptr createInstallTask(PackagePair& pair,constInstallOptions& options) Creates a package installation task for the given pair.
public virtual std::string installedPackageVersion(const std::string & id) const
public virtualPackage::AssetgetLatestInstallableAsset(constPackagePair& pair,constInstallOptions& options) const
public virtual bool hasAvailableUpdates(constPackagePair& pair) const Returns true if there are updates available for this package, false otherwise.
public void clearCache() Clears all files in the cache directory.
public bool clearPackageCache(LocalPackage& package) Clears a package archive from the local cache.
public bool clearCacheFile(const std::string & fileName,bool whiny) Clears a file from the local cache.
public bool hasCachedFile(Package::Asset& asset) Checks if a package archive exists in the local cache.
public bool isSupportedFileType(const std::string & fileName) Checks if the file type is a supported package archive.
public std::string getCacheFilePath(const std::string & fileName)
public std::string getPackageDataDir(const std::string & id)
public virtualOptions& options()
public virtualRemotePackageStore& remotePackages()
public virtualLocalPackageStore& localPackages()
protected mutableMutex_mutex
protectedLocalPackageStore_localPackages
protectedRemotePackageStore_remotePackages
protected InstallTaskPtrVec _tasks
protectedOptions_options
protected void onPackageInstallComplete(void * sender)
protected void onPackageQueryResponse(void * sender,consthttp::Response& response)

Members

public`Signal< const http::Response`& > RemotePackageResponse

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

public`Signal< LocalPackage`& > PackageUninstalled

Signals when a package is uninstalled.

public`Signal< InstallTask`& > InstallTaskCreated

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

public`Signal< const InstallTask`& > InstallTaskComplete

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

public PackageManager(constOptions& options)

public virtual ~PackageManager()

public virtual void initialize()

public virtual void uninitialize()

public virtual bool initialized() const

public virtual void createDirectories()

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

public virtual void queryRemotePackages()

Queries the server for a list of available packages.

public virtual void loadLocalPackages()

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

public virtual void loadLocalPackages(const std::string & dir)

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.

public virtual bool saveLocalPackages(bool whiny)

public virtual bool saveLocalPackage(LocalPackage& package,bool whiny)

Saves the local package manifest to the file system.

public virtual InstallTask::Ptr installPackage(const std::string & name,constInstallOptions& options)

Installs a single package. The returned 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.

public virtual bool installPackages(const StringVec & ids,constInstallOptions& options,InstallMonitor* monitor,bool whiny)

Installs multiple packages. The same options will be passed to each task. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor.

public virtual InstallTask::Ptr updatePackage(const std::string & name,constInstallOptions& options)

Updates a single package. Throws an exception if the package does not exist. The returned InstallTask must be started.

public virtual bool updatePackages(const StringVec & ids,constInstallOptions& options,InstallMonitor* monitor,bool whiny)

Updates multiple packages. Throws an exception if the package does not exist. If a InstallMonitor instance was passed in the tasks will need to be started, otherwise they will be auto-started. The PackageManager does not take ownership of the InstallMonitor.

public virtual bool updateAllPackages(bool whiny)

Updates all installed packages.

public virtual bool uninstallPackages(const StringVec & ids,bool whiny)

Uninstalls multiple packages.

public virtual bool uninstallPackage(const std::string & id,bool whiny)

Uninstalls a single package.

public virtual bool hasUnfinalizedPackages()

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.

public virtual bool finalizeInstallations(bool whiny)

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.

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

Gets the install task for the given package ID.

public virtual InstallTaskPtrVec tasks() const

Returns a list of all tasks.

public virtual void cancelAllTasks()

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

public virtual PackagePairVec getPackagePairs() const

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

public virtual PackagePairVec getUpdatablePackagePairs() 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.

public virtualPackagePairgetPackagePair(const std::string & id,bool whiny) 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.

public virtualPackagePairgetOrCreatePackagePair(const std::string & id)

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.

public virtual InstallTask::Ptr createInstallTask(PackagePair& pair,constInstallOptions& options)

Creates a package installation task for the given pair.

public virtual std::string installedPackageVersion(const std::string & id) const

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

public virtualPackage::AssetgetLatestInstallableAsset(constPackagePair& pair,constInstallOptions& options) 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.

public virtual bool hasAvailableUpdates(constPackagePair& pair) const

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

public void clearCache()

Clears all files in the cache directory.

public bool clearPackageCache(LocalPackage& package)

Clears a package archive from the local cache.

public bool clearCacheFile(const std::string & fileName,bool whiny)

Clears a file from the local cache.

public bool hasCachedFile(Package::Asset& asset)

Checks if a package archive exists in the local cache.

public bool isSupportedFileType(const std::string & fileName)

Checks if the file type is a supported package archive.

public std::string getCacheFilePath(const std::string & fileName)

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

public std::string getPackageDataDir(const std::string & id)

Returns the package data directory for the given package ID.

public virtualOptions& options()

public virtualRemotePackageStore& remotePackages()

public virtualLocalPackageStore& localPackages()

protected mutableMutex_mutex

protectedLocalPackageStore_localPackages

protectedRemotePackageStore_remotePackages

protected InstallTaskPtrVec _tasks

protectedOptions_options

protected void onPackageInstallComplete(void * sender)

protected void onPackageQueryResponse(void * sender,consthttp::Response& response)

struct scy::pacm::InstallationState

struct scy::pacm::InstallationState
  : public scy::State

Summary

Members Descriptions
public inline virtual std::string str(unsigned int id) const

Members

public inline virtual std::string str(unsigned int id) const

struct scy::pacm::InstallOptions

Package installation options.

Summary

Members Descriptions
public std::string version If set then the given package version will be installed.
public std::string sdkVersion
public std::string installDir
public inline InstallOptions()

Members

public std::string version

If set then the given package version will be installed.

public std::string sdkVersion

If set then the latest package version for given SDK version will be installed.

public std::string installDir

Install to the given location, otherwise the manager default installDir will be used.

public inline InstallOptions()

struct scy::pacm::LocalPackage

struct scy::pacm::LocalPackage
  : public scy::pacm::Package

This class is a JSON representation of an installed local package that exists on the file system.

Summary

Members Descriptions
public LocalPackage()
public LocalPackage(const json::Value & src)
public LocalPackage(constRemotePackage& src)
public virtual ~LocalPackage()
public virtual void setState(const std::string & state)
public virtual void setInstallState(const std::string & state)
public virtual void setInstallDir(const std::string & dir) Set's the installation directory for this package.
public virtual void setInstalledAsset(constPackage::Asset& installedRemoteAsset)
public virtual void setVersion(const std::string & version)
public virtual void setVersionLock(const std::string & version)
public virtual void setSDKVersionLock(const std::string & version)
public virtual std::string version() const Returns the installed package version.
public virtual std::string state() const Returns the current state of this package.
public virtual std::string installState() const Returns the installation state of this package.
public virtual std::string installDir() const Returns the installation directory for this package.
public virtual std::string versionLock() const
public virtual std::string sdkLockedVersion() const
public virtualAssetasset()
public virtual bool isInstalled() const
public virtual bool isFailed() const
public virtualManifestmanifest() Returns the installation manifest.
public virtual bool verifyInstallManifest(bool allowEmpty)
public virtual std::string getInstalledFilePath(const std::string & fileName,bool whiny)
public virtual json::Value & errors()
public virtual void addError(const std::string & message)
public virtual std::string lastError() const
public virtual void clearErrors()
public virtual bool valid() const

Members

public LocalPackage()

public LocalPackage(const json::Value & src)

public LocalPackage(constRemotePackage& 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.

public virtual ~LocalPackage()

public 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.

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

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

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

Set's the installation directory for this package.

public virtual void setInstalledAsset(constPackage::Asset& installedRemoteAsset)

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

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

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

public 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.

public 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.

public virtual std::string version() const

Returns the installed package version.

public virtual std::string state() const

Returns the current state of this package.

public virtual std::string installState() const

Returns the installation state of this package.

public virtual std::string installDir() const

Returns the installation directory for this package.

public virtual std::string versionLock() const

public virtual std::string sdkLockedVersion() const

public virtualAssetasset()

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

public 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.

public virtual bool isFailed() const

public virtualManifestmanifest()

Returns the installation manifest.

public virtual bool verifyInstallManifest(bool allowEmpty)

public 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.

public virtual json::Value & errors()

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

public virtual std::string lastError() const

public virtual void clearErrors()

public virtual bool valid() const

struct scy::pacm::Package

struct scy::pacm::Package
  : public Value

This class is a JSON representation of an package belonging to the PackageManager.

Summary

Members Descriptions
public Package()
public Package(const json::Value & src)
public virtual ~Package()
public virtual std::string id() const
public virtual std::string name() const
public virtual std::string type() const
public virtual std::string author() const
public virtual std::string description() const
public virtual bool valid() const
public virtual void print(std::ostream & ost) const

Members

public Package()

public Package(const json::Value & src)

public virtual ~Package()

public virtual std::string id() const

public virtual std::string name() const

public virtual std::string type() const

public virtual std::string author() const

public virtual std::string description() const

public virtual bool valid() const

public virtual void print(std::ostream & ost) const

struct scy::pacm::PackagePair

This class provides pairing of a local and a remote package.

Summary

Members Descriptions
publicLocalPackage* local
publicRemotePackage* remote
public PackagePair(LocalPackage* local,RemotePackage* remote)
public virtual bool valid() const
public std::string id() const
public std::string name() const
public std::string type() const
public std::string author() const

Members

publicLocalPackage* local

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

publicRemotePackage* remote

public PackagePair(LocalPackage* local,RemotePackage* remote)

public virtual bool valid() const

public std::string id() const

public std::string name() const

public std::string type() const

public std::string author() const

struct scy::pacm::RemotePackage

struct scy::pacm::RemotePackage
  : public scy::pacm::Package

This class is a JSON representation of an package existing on the remote server that may be downloaded and installed.

Summary

Members Descriptions
public RemotePackage()
public RemotePackage(const json::Value & src)
public virtual ~RemotePackage()
public virtual json::Value & assets()
public virtualAssetlatestAsset()
public virtualAssetassetVersion(const std::string & version)
public virtualAssetlatestSDKAsset(const std::string & version)

Members

public RemotePackage()

public RemotePackage(const json::Value & src)

public virtual ~RemotePackage()

public virtual json::Value & assets()

public virtualAssetlatestAsset()

Returns the latest asset for this package. For local packages this is the currently installed version. For remote packages this is the latest available version. Throws an exception if no asset exists.

public virtualAssetassetVersion(const std::string & version)

Returns the latest asset for the given package version. Throws an exception if no asset exists.

public virtualAssetlatestSDKAsset(const std::string & version)

Returns the latest asset for the given SDK version. This method is for safely installing plug-ins which must be compiled against a specific SDK version. The package JSON must have a "sdk-version" member for this function to work as intended. Throws an exception if no asset exists.

results matching ""

    No results matching ""