AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAssets::manager::AssetManager Class Reference

#include <AssetManager.h>

Inheritance diagram for alexaClientSDK::acsdkAssets::manager::AssetManager:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAssets::manager::AssetManager:
Collaboration graph
[legend]

Public Member Functions

 ~AssetManager () override
 
bool downloadArtifact (const std::shared_ptr< commonInterfaces::ArtifactRequest > &request)
 
void queueDownloadArtifact (const std::shared_ptr< commonInterfaces::ArtifactRequest > &request)
 
bool queueDownloadArtifact (const std::string &requestString)
 
void deleteArtifact (const std::string &summaryString)
 
void queueDeleteArtifact (const std::string &summaryString)
 
void handleUpdate (const std::string &summaryString, bool acceptUpdate)
 
void queueHandleUpdate (const std::string &summaryString, bool acceptUpdate)
 
bool freeUpSpace (size_t requestedAmount)
 
void queueFreeUpSpace (size_t requestedAmount)
 
void onIdleChanged (int value)
 
size_t getBudget ()
 
void setBudget (uint32_t valueMB)
 
bool functionToBeInvoked (const std::string &name, std::string arg) override
 
- Public Member Functions inherited from alexaClientSDK::acsdkCommunicationInterfaces::FunctionInvokerInterface< bool, std::string >
virtual ~FunctionInvokerInterface ()=default
 
virtual bool functionToBeInvoked (const std::string &name, Types... args)=0
 

Static Public Member Functions

static std::shared_ptr< AssetManagercreate (const std::shared_ptr< commonInterfaces::AmdCommunicationInterface > &communicationHandler, const std::shared_ptr< davs::DavsClient > &davsClient, const std::string &artifactsDirectory, const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface > &authDelegate, const std::shared_ptr< UrlAllowListWrapper > &allowList)
 

Constructor & Destructor Documentation

◆ ~AssetManager()

alexaClientSDK::acsdkAssets::manager::AssetManager::~AssetManager ( )
override

Member Function Documentation

◆ create()

static std::shared_ptr<AssetManager> alexaClientSDK::acsdkAssets::manager::AssetManager::create ( const std::shared_ptr< commonInterfaces::AmdCommunicationInterface > &  communicationHandler,
const std::shared_ptr< davs::DavsClient > &  davsClient,
const std::string &  artifactsDirectory,
const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface > &  authDelegate,
const std::shared_ptr< UrlAllowListWrapper > &  allowList 
)
static

Creates a a new Asset Manager with a davs client handle and base directory to work off of.

Parameters
communicationHandlerREQUIRED, used to communicate the values of properties and functions
davsClientREQUIRED, used to register artifact and communicate with DAVS.
artifactsDirectoryREQUIRED, base directory where the artifacts are to be stored.
authDelegateREQUIRED, the Authentication Delegate to generate the authentication token.
allowListREQUIRED, URL allow list wrapper used for managing downloads from URLs.
Returns
NULLABLE, pointer to new AssetManager, null if failed.

◆ deleteArtifact()

void alexaClientSDK::acsdkAssets::manager::AssetManager::deleteArtifact ( const std::string &  summaryString)

Requests the deletion and removal of an existing artifact by deleting its requester.

Parameters
summaryStringREQUIRED, summary of an existing artifact.

◆ downloadArtifact()

bool alexaClientSDK::acsdkAssets::manager::AssetManager::downloadArtifact ( const std::shared_ptr< commonInterfaces::ArtifactRequest > &  request)

Requests a creation of a new requester if it does not already exists based off a json request. Use an existing requester if it matches the json request.

Parameters
requestREQUIRED, a request that represents an artifact in DAVS.
Returns
weather the operation was successful.

◆ freeUpSpace()

bool alexaClientSDK::acsdkAssets::manager::AssetManager::freeUpSpace ( size_t  requestedAmount)

Goes through the available requesters and deletes unused requesters and their artifacts based on used time and priority.

Note
this operation could take a while as it goes through and deletes artifacts until the requested amount is satisfied.
Parameters
requestedAmountsize in bytes that is needed to be cleared.
Returns
true if the requested amount was freed up, false otherwise.

◆ functionToBeInvoked()

bool alexaClientSDK::acsdkAssets::manager::AssetManager::functionToBeInvoked ( const std::string &  name,
std::string  arg 
)
override

◆ getBudget()

size_t alexaClientSDK::acsdkAssets::manager::AssetManager::getBudget ( )
Returns
Get the current budget in MB

◆ handleUpdate()

void alexaClientSDK::acsdkAssets::manager::AssetManager::handleUpdate ( const std::string &  summaryString,
bool  acceptUpdate 
)

Handles the pending update for a specific requester given its summary string.

Parameters
summaryStringfor an artifact request that maps to a requester handling the update.
acceptUpdateweather to accept the update or reject it.

◆ onIdleChanged()

void alexaClientSDK::acsdkAssets::manager::AssetManager::onIdleChanged ( int  value)

Callback method when application changes idle state.

Parameters
value,intvalue that will be parsed to a bool

◆ queueDeleteArtifact()

void alexaClientSDK::acsdkAssets::manager::AssetManager::queueDeleteArtifact ( const std::string &  summaryString)
inline

Queues up a call to deleteArtifact in an executor. Returns immediately.

◆ queueDownloadArtifact() [1/2]

void alexaClientSDK::acsdkAssets::manager::AssetManager::queueDownloadArtifact ( const std::shared_ptr< commonInterfaces::ArtifactRequest > &  request)
inline

Queues up a call to downloadArtifact in an executor. Returns immediately.

◆ queueDownloadArtifact() [2/2]

bool alexaClientSDK::acsdkAssets::manager::AssetManager::queueDownloadArtifact ( const std::string &  requestString)

Takes string and tries to make it a ArtifactRequest Queues up a call to downloadArtifact in an executor. Returns immediately.

Parameters
requestStringstring that represents the ArtifactRequest
Returns
true, if successfully able to queue up call, false otherwise

◆ queueFreeUpSpace()

void alexaClientSDK::acsdkAssets::manager::AssetManager::queueFreeUpSpace ( size_t  requestedAmount)
inline

Queues up a call to freeUpSpace in an executor. Returns immediately.

◆ queueHandleUpdate()

void alexaClientSDK::acsdkAssets::manager::AssetManager::queueHandleUpdate ( const std::string &  summaryString,
bool  acceptUpdate 
)
inline

Queues up a call to handleUpdate in an executor. Returns immediately.

◆ setBudget()

void alexaClientSDK::acsdkAssets::manager::AssetManager::setBudget ( uint32_t  valueMB)

This method sets the budget for asset manager in megabytes. If the new budget is set to a number less than the current data stored asset manager will attempt to clear as many artifacts as possible to be within the threshold.

Parameters
valueMB,intthe number of MB for the new budget.

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0