AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
SQLiteCapabilitiesDelegateStorage.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_CAPABILITIESDELEGATE_INCLUDE_CAPABILITIESDELEGATE_STORAGE_SQLITECAPABILITIESDELEGATESTORAGE_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITIESDELEGATE_INCLUDE_CAPABILITIESDELEGATE_STORAGE_SQLITECAPABILITIESDELEGATESTORAGE_H_
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <unordered_map>
23 
27 
28 namespace alexaClientSDK {
29 namespace capabilitiesDelegate {
30 namespace storage {
31 
36 public:
43  static std::unique_ptr<CapabilitiesDelegateStorageInterface> createCapabilitiesDelegateStorageInterface(
44  const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>& configurationRoot);
45 
53  static std::unique_ptr<SQLiteCapabilitiesDelegateStorage> create(
55 
58  bool createDatabase() override;
59  bool open() override;
60  void close() override;
61  bool store(const std::string& endpointId, const std::string& endpointConfig) override;
62  bool store(const std::unordered_map<std::string, std::string>& endpointIdToConfigMap) override;
63  bool load(std::unordered_map<std::string, std::string>* endpointConfigMap) override;
64  bool load(const std::string& endpointId, std::string* endpointConfig) override;
65  bool erase(const std::string& endpointId) override;
66  bool erase(const std::unordered_map<std::string, std::string>& endpointIdToConfigMap) override;
67  bool clearDatabase() override;
69 
74 
75 private:
82 
90  bool storeLocked(const std::string& endpointId, const std::string& endpointConfig);
91 
98  bool eraseLocked(const std::string& endpointId);
99 
106  bool createEndpointConfigTableLocked();
107 
112  void closeLocked();
113 
115  std::mutex m_mutex;
116 
119 };
120 
121 } // namespace storage
122 } // namespace capabilitiesDelegate
123 } // namespace alexaClientSDK
124 
125 #endif // ALEXA_CLIENT_SDK_CAPABILITIESDELEGATE_INCLUDE_CAPABILITIESDELEGATE_STORAGE_SQLITECAPABILITIESDELEGATESTORAGE_H_
::std::string string
Definition: gtest-port.h:1097
bool load(std::unordered_map< std::string, std::string > *endpointConfigMap) override
static std::unique_ptr< SQLiteCapabilitiesDelegateStorage > create(const avsCommon::utils::configuration::ConfigurationNode &configurationRoot)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::unique_ptr< CapabilitiesDelegateStorageInterface > createCapabilitiesDelegateStorageInterface(const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &configurationRoot)
bool store(const std::string &endpointId, const std::string &endpointConfig) override

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