// // License type: BSD 3-Clause License // License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE // // Created by Stephane Bourque on 2021-03-04. // Arilia Wireless Inc. // #ifndef UCENTRAL_USTORAGESERVICE_H #define UCENTRAL_USTORAGESERVICE_H #include "RESTObjects/RESTAPI_SecurityObjects.h" #include "framework/StorageClass.h" #include "AuthService.h" #include "Poco/Timer.h" #include "storage/orm_users.h" #include "storage/orm_tokens.h" #include "storage/orm_preferences.h" #include "storage/orm_actionLinks.h" #include "storage/orm_avatar.h" #include "storage/orm_logins.h" namespace OpenWifi { class Archiver { public: void onTimer(Poco::Timer & timer); private: }; class StorageService : public StorageClass { public: static auto instance() { static auto instance_ = new StorageService; return instance_; } int Start() override; void Stop() override; OpenWifi::BaseUserDB & UserDB() { return *UserDB_; } OpenWifi::BaseUserDB & SubDB() { return *SubDB_; } OpenWifi::BaseTokenDB & UserTokenDB() { return *UserTokenDB_; } OpenWifi::BaseTokenDB & SubTokenDB() { return *SubTokenDB_; } OpenWifi::PreferencesDB & PreferencesDB() { return *PreferencesDB_; } OpenWifi::PreferencesDB & SubPreferencesDB() { return *SubPreferencesDB_; } OpenWifi::ActionLinkDB & ActionLinksDB() { return *ActionLinksDB_; } OpenWifi::AvatarDB & AvatarDB() { return *AvatarDB_; } OpenWifi::AvatarDB & SubAvatarDB() { return *SubAvatarDB_; } OpenWifi::LoginDB & LoginDB() { return *LoginDB_; } OpenWifi::LoginDB & SubLoginDB() { return *SubLoginDB_; } private: std::unique_ptr UserDB_; std::unique_ptr SubDB_; std::unique_ptr UserTokenDB_; std::unique_ptr SubTokenDB_; std::unique_ptr PreferencesDB_; std::unique_ptr SubPreferencesDB_; std::unique_ptr ActionLinksDB_; std::unique_ptr AvatarDB_; std::unique_ptr SubAvatarDB_; std::unique_ptr LoginDB_; std::unique_ptr SubLoginDB_; std::unique_ptr UserCache_; std::unique_ptr SubCache_; std::unique_ptr UserTokenCache_; std::unique_ptr SubTokenCache_; Poco::Timer Timer_; Archiver Archiver_; std::unique_ptr> Archivercallback_; }; inline auto StorageService() { return StorageService::instance(); }; } // namespace #endif //UCENTRAL_USTORAGESERVICE_H