16 #ifndef ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_CACHINGDOWNLOADMANAGER_H_ 17 #define ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_CACHINGDOWNLOADMANAGER_H_ 29 namespace sampleApplications {
30 namespace ipcServerSampleApp {
77 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface>
78 httpContentFetcherInterfaceFactoryInterface,
79 unsigned long cachePeriodInSeconds,
80 unsigned long maxCacheSize,
81 std::shared_ptr<avsCommon::sdkInterfaces::storage::MiscStorageInterface> miscStorage,
82 const std::shared_ptr<registrationManager::CustomerDataManagerInterface> customerDataManager);
139 void clearData()
override;
150 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface> m_contentFetcherFactory;
154 std::chrono::duration<double> m_cachePeriod;
158 unsigned long m_maxCacheSize;
162 std::unordered_map<std::string, CachingDownloadManager::CachedContent> cachedContentMap;
166 std::mutex cachedContentMapMutex;
170 std::shared_ptr<avsCommon::sdkInterfaces::storage::MiscStorageInterface> m_miscStorage;
181 auto time = std::chrono::duration_cast<std::chrono::seconds>(content.
importTime.time_since_epoch()).
count();
182 return std::to_string(time) + delimiter + content.
content;
189 #endif // ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_CACHINGDOWNLOADMANAGER_H_ CachingDownloadManager(std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface > httpContentFetcherInterfaceFactoryInterface, unsigned long cachePeriodInSeconds, unsigned long maxCacheSize, std::shared_ptr< avsCommon::sdkInterfaces::storage::MiscStorageInterface > miscStorage, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > customerDataManager)
int * count
Definition: gmock_stress_test.cc:176
::std::string string
Definition: gtest-port.h:1097
Definition: CachingDownloadManager.h:96
Single-thread executor implementation.
Definition: Executor.h:45
Definition: CachingDownloadManager.h:34
virtual void onDownloadComplete()
Definition: CachingDownloadManager.h:47
virtual void onDownloadFailed()
Definition: CachingDownloadManager.h:52
std::string cachedContentToString(CachingDownloadManager::CachedContent content, std::string delimiter)
Definition: CachingDownloadManager.h:180
virtual ~Observer()=default
std::chrono::system_clock::time_point importTime
Definition: CachingDownloadManager.h:101
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual void onDownloadStarted()
Definition: CachingDownloadManager.h:42
std::string retrieveContent(const std::string &source, std::shared_ptr< Observer > observer=nullptr)
std::string content
Definition: CachingDownloadManager.h:105
virtual void onBytesRead(uint64_t numberOfBytes)
Definition: CachingDownloadManager.h:65
Definition: CachingDownloadManager.h:32
virtual void onCacheHit()
Definition: CachingDownloadManager.h:57
Definition: CustomerDataHandler.h:34