AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | List of all members
alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface Class Referenceabstract

#include <MiscStorageInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface:
Inheritance graph
[legend]

Public Types

enum  KeyType { KeyType::UNKNOWN_KEY, KeyType::STRING_KEY }
 The type of the key column in Misc DB. More...
 
enum  ValueType { ValueType::UNKNOWN_VALUE, ValueType::STRING_VALUE }
 The type of the value column in Misc DB. More...
 

Public Member Functions

virtual ~MiscStorageInterface ()=default
 
virtual bool createDatabase ()=0
 
virtual bool open ()=0
 
virtual bool isOpened ()=0
 
virtual void close ()=0
 
virtual bool createTable (const std::string &componentName, const std::string &tableName, KeyType keyType, ValueType valueType)=0
 
virtual bool clearTable (const std::string &componentName, const std::string &tableName)=0
 
virtual bool deleteTable (const std::string &componentName, const std::string &tableName)=0
 
virtual bool get (const std::string &componentName, const std::string &tableName, const std::string &key, std::string *value)=0
 
virtual bool add (const std::string &componentName, const std::string &tableName, const std::string &key, const std::string &value)=0
 
virtual bool update (const std::string &componentName, const std::string &tableName, const std::string &key, const std::string &value)=0
 
virtual bool put (const std::string &componentName, const std::string &tableName, const std::string &key, const std::string &value)=0
 
virtual bool remove (const std::string &componentName, const std::string &tableName, const std::string &key)=0
 
virtual bool tableEntryExists (const std::string &componentName, const std::string &tableName, const std::string &key, bool *tableEntryExistsValue)=0
 
virtual bool tableExists (const std::string &componentName, const std::string &tableName, bool *tableExistsValue)=0
 
virtual bool load (const std::string &componentName, const std::string &tableName, std::unordered_map< std::string, std::string > *valueContainer)=0
 

Detailed Description

This class provides an interface to MiscStorage - a simple key/value database. Since this database is supposed to be shared by various components of the SDK, there could be conflicts in the table names across different SDK components. Hence, the APIs take the SDK component name as well as the table name so that table names can be unique within a specific SDK component.

Member Enumeration Documentation

◆ KeyType

The type of the key column in Misc DB.

Enumerator
UNKNOWN_KEY 

Unknown type.

STRING_KEY 

String key.

◆ ValueType

The type of the value column in Misc DB.

Enumerator
UNKNOWN_VALUE 

Unknown type.

STRING_VALUE 

String value.

Constructor & Destructor Documentation

◆ ~MiscStorageInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::~MiscStorageInterface ( )
virtualdefault

Destructor

Member Function Documentation

◆ add()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::add ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key,
const std::string &  value 
)
pure virtual

Adds a value in the table.

Parameters
componentNameThe component name.
tableNameThe table name.
keyThe key for the table entry.
valueThe value of the table entry.
Note
value should be a string literal.
Returns
true If the value was added ok, false if not.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ clearTable()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::clearTable ( const std::string &  componentName,
const std::string &  tableName 
)
pure virtual

Removes all the entries in the table. The table itself will continue to exist.

Parameters
componentNameThe component name.
tableNameThe table name.
Returns
true If the table is cleared ok, false if the table couldn't be cleared.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ close()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::close ( )
pure virtual

◆ createDatabase()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::createDatabase ( )
pure virtual

Creates a new database. If a database is already being handled by this object or there is another internal error, then this function returns false.

Returns
true If the database is created ok, or false if a database is already being handled by this object or there is a problem creating the database.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ createTable()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::createTable ( const std::string &  componentName,
const std::string &  tableName,
KeyType  keyType,
ValueType  valueType 
)
pure virtual

Create a simple key/value pair table. If there is a problem creating the table, this function returns false.

Parameters
componentNameThe component name.
tableNameThe table name.
keyTypeThe key type.
valueTypeThe value type.
Returns
true If the table is created ok, false if the table couldn't be created.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ deleteTable()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::deleteTable ( const std::string &  componentName,
const std::string &  tableName 
)
pure virtual

Deletes the table. The table must be empty before you can delete the table.

Parameters
componentNameThe component name.
tableNameThe table name.
Returns
true If the table is deleted ok, false if the table couldn't be deleted.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ get()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::get ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key,
std::string *  value 
)
pure virtual

Gets the value associated with a key in the table.

Parameters
componentNameThe component name.
tableNameThe table name.
keyThe key for the table entry.
[out]valueThe value associated with the key in the table.
Returns
true If the value was found out ok, false if not.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ isOpened()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::isOpened ( )
pure virtual

Returns true if this object is already managing an open database, false otherwise.

Returns
True if this object is already managing an open database, false otherwise.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ load()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::load ( const std::string &  componentName,
const std::string &  tableName,
std::unordered_map< std::string, std::string > *  valueContainer 
)
pure virtual

Loads the table entries into a map.

Parameters
componentNameThe component name.
tableNameThe table name.
[out]valueContainerThe container for the values in the table.
Returns
true If the values were loaded ok, false if not.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ open()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::open ( )
pure virtual

Open an existing database. If this object is already managing an open database, or there is a problem opening the database, this function returns false.

Returns
true If the database is opened ok, false if this object is already managing an open database, or if there is another internal reason the database could not be opened.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ put()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::put ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key,
const std::string &  value 
)
pure virtual

Puts a value in the table. Basically, this will add the entry for the key if it doesn't already exist, or it will update the entry for the key if it already exists.

Parameters
componentNameThe component name.
tableNameThe table name.
keyThe key for the table entry.
valueThe value of the table entry.
Note
value should be a literal string.
Returns
true If the value was put ok, false if not.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ remove()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::remove ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key 
)
pure virtual

Removes a value from the table.

Parameters
componentNameThe component name.
tableNameThe table name.
keyThe key for the table entry.
Returns
true If the value was removed ok, false if not.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ tableEntryExists()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::tableEntryExists ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key,
bool *  tableEntryExistsValue 
)
pure virtual

Checks if a key exists in the table.

Parameters
componentNameThe component name.
tableNameThe table name.
keyThe key for the table entry.
[out]tableEntryExistsValueTrue if the key exists, false if not.
Returns
true if the table entry's existence was found out ok, else false..

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ tableExists()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::tableExists ( const std::string &  componentName,
const std::string &  tableName,
bool *  tableExistsValue 
)
pure virtual

Checks if a table exists in the DB.

Parameters
componentNameThe component name.
tableNameThe table name.
[out]tableExistsValueTrue if the table exists, false if not.
Returns
true if the table's existence was found out ok, else false.

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.

◆ update()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::storage::MiscStorageInterface::update ( const std::string &  componentName,
const std::string &  tableName,
const std::string &  key,
const std::string &  value 
)
pure virtual

Updates a value in the table.

Parameters
tableNameThe table name.
keyThe key for the table entry.
valueThe value of the table entry.
Note
value should be a literal string.
Returns
true If the value was updated ok, false if not (including if the entry does not exist).

Implemented in alexaClientSDK::storage::sqliteStorage::SQLiteMiscStorage, and alexaClientSDK::avsCommon::sdkInterfaces::storage::test::StubMiscStorage.


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