Fledge
An open source edge computing platform for industrial users
storage_service.h
1 #ifndef _STORAGE_SERVICE_H
2 #define _STORAGE_SERVICE_H
3 /*
4  * Fledge storage service.
5  *
6  * Copyright (c) 2017 OSisoft, LLC
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 
13 #include <storage_api.h>
14 #include <logger.h>
15 #include <configuration.h>
16 #include <storage_plugin.h>
17 #include <plugin_configuration.h>
18 #include <service_handler.h>
19 
20 #define SERVICE_NAME "Fledge Storage"
21 
29  public:
30  StorageService(const string& name);
32  void start(std::string& coreAddress, unsigned short corePort);
33  void stop();
34  void shutdown();
35  void restart();
36  bool isRunning() { return !m_shutdown; };
37  void configChange(const std::string&, const std::string&);
38  void configChildCreate(const std::string&, const std::string&, const std::string&){};
39  void configChildDelete(const std::string& , const std::string&){};
40  string getPluginName();
41  string getPluginManagedStatus();
42  string getReadingPluginName();
43  void setLogLevel(std::string level)
44  {
45  m_logLevel = level;
46  };
47  private:
48  const string& m_name;
49  bool loadPlugin();
50  StorageApi *api;
51  StorageConfiguration *config;
52  Logger *logger;
53  StoragePlugin *storagePlugin;
54  StoragePlugin *readingPlugin;
55  bool m_shutdown;
56  bool m_requestRestart;
57  std::string m_logLevel;
58  long m_timeout;
59 };
60 #endif
Fledge Logger class used to log to syslog.
Definition: logger.h:26
StorageService(const string &name)
Constructor for the storage service.
Definition: storage.cpp:218
Class that represents a storage plugin.
Definition: storage_plugin.h:34
The storage service must handle its own configuration differently to other services as it is unable t...
Definition: configuration.h:32
string getPluginManagedStatus()
Return the managed status of the storage plugin.
Definition: storage.cpp:647
void configChange(const std::string &, const std::string &)
Configuration change notification.
Definition: storage.cpp:586
string getPluginName()
Return the name of the configured storage service.
Definition: storage.cpp:639
void restart()
Restart request.
Definition: storage.cpp:572
ServiceHandler abstract class - the interface that services using the management API must provide...
Definition: service_handler.h:20
The StorageService class.
Definition: storage_service.h:28
void shutdown()
Shutdown request.
Definition: storage.cpp:558
The Storage API class - this class is responsible for the registration of all API entry points in the...
Definition: storage_api.h:84
string getReadingPluginName()
Return the name of the configured reading plugin.
Definition: storage.cpp:655
void start(std::string &coreAddress, unsigned short corePort)
Start the storage service.
Definition: storage.cpp:287
void stop()
Stop the storage service/.
Definition: storage.cpp:464
~StorageService()
Storage Service destructor.
Definition: storage.cpp:277