AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | List of all members
alexaClientSDK::certifiedSender::MessageStorageInterface Class Referenceabstract

#include <MessageStorageInterface.h>

Inheritance diagram for alexaClientSDK::certifiedSender::MessageStorageInterface:
Inheritance graph
[legend]

Classes

struct  StoredMessage
 

Public Member Functions

virtual ~MessageStorageInterface ()=default
 
virtual bool createDatabase ()=0
 
virtual bool open ()=0
 
virtual void close ()=0
 
virtual bool store (const std::string &message, int *id)=0
 
virtual bool store (const std::string &message, const std::string &uriPathExtension, int *id)=0
 
virtual bool load (std::queue< StoredMessage > *messageContainer)=0
 
virtual bool erase (int messageId)=0
 
virtual bool clearDatabase ()=0
 

Detailed Description

An Interface class which defines APIs for interacting with a database for storing text-based messages.

An implementation of this interface must enforce ordering of the messages, so that the ordering of items returned in the load() operation are the same as the ordering of store() calls.

This interface does not provide any thread-safety guarantees.

Constructor & Destructor Documentation

◆ ~MessageStorageInterface()

virtual alexaClientSDK::certifiedSender::MessageStorageInterface::~MessageStorageInterface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ clearDatabase()

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::clearDatabase ( )
pure virtual

A utility function to clear the database of all records. Note that the database will still exist, as will the tables. Only the rows will be erased.

Returns
Whether the database was successfully cleared.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ close()

virtual void alexaClientSDK::certifiedSender::MessageStorageInterface::close ( )
pure virtual

Close the currently open database, if one is open.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ createDatabase()

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::createDatabase ( )
pure virtual

Creates a new database with the given filePath. If a database is already being handled by this object, or there is are other errors creating the database, 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 an internal error creating the database.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ erase()

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::erase ( int  messageId)
pure virtual

Erases a single message from the database.

Parameters
messageIdThe id of the message to be erased.
Returns
Whether the message was successfully erased.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ load()

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::load ( std::queue< StoredMessage > *  messageContainer)
pure virtual

Loads all messages in the database.

Parameters
[out]messageContainerThe container where messages should be stored.
Returns
Whether the StoredMessages were successfully loaded.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ open()

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::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::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ store() [1/2]

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::store ( const std::string &  message,
int *  id 
)
pure virtual

Stores a single message in the database.

Parameters
Themessage to store.
[out]idThe id associated with the stored messsage, if successfully stored.
Returns
Whether the message was successfully stored.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.

◆ store() [2/2]

virtual bool alexaClientSDK::certifiedSender::MessageStorageInterface::store ( const std::string &  message,
const std::string &  uriPathExtension,
int *  id 
)
pure virtual

Stores a single message and its uri in the database.

Parameters
Themessage to store.
uriPathExtensionpath extension which will be appended to the base url of the AVS when sending the event.
[out]idThe id associated with the stored messsage, if successfully stored.
Returns
Whether the message was successfully stored.

Implemented in alexaClientSDK::acsdkAlerts::test::StubMessageStorage, and alexaClientSDK::certifiedSender::SQLiteMessageStorage.


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

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