 |
Fledge
An open source edge computing platform for industrial users
|
1 #ifndef _NORTH_SERVICE_H
2 #define _NORTH_SERVICE_H
14 #include <north_plugin.h>
15 #include <service_handler.h>
16 #include <storage_client.h>
17 #include <config_category.h>
18 #include <filter_plugin.h>
20 #include <condition_variable>
21 #include <audit_logger.h>
22 #include <perfmonitors.h>
23 #include <data_load.h>
24 #include <data_sender.h>
26 #define SERVICE_NAME "Fledge North"
31 #define DEBUG_ATTACHED 0x01
32 #define DEBUG_SUSPENDED 0x02
33 #define DEBUG_ISOLATED 0x04
45 const std::string& token =
"");
47 void start(std::string& coreAddress,
48 unsigned short corePort);
52 void configChange(
const std::string&,
const std::string&);
53 void configChildCreate(
const std::string& ,
const std::string&,
const std::string&){};
54 void configChildDelete(
const std::string& ,
const std::string&){};
55 bool isRunning() {
return !m_shutdown; };
56 const std::string& getName() {
return m_name; };
57 const std::string& getPluginName() {
return m_pluginName; };
60 bool write(
const std::string& name,
const std::string& value,
const ControlDestination);
61 bool write(
const std::string& name,
const std::string& value,
const ControlDestination,
const std::string& arg);
62 int operation(
const std::string& name,
int paramCount,
char *names[],
char *parameters[],
const ControlDestination);
63 int operation(
const std::string& name,
int paramCount,
char *names[],
char *parameters[],
const ControlDestination,
const std::string& arg);
64 void setDryRun() { m_dryRun =
true; };
65 bool getDryRun() {
return m_dryRun; };
73 m_debugState = DEBUG_ATTACHED;
74 return m_dataLoad->attachDebugger();
81 m_dataLoad->detachDebugger();
82 suspendDebugger(
false);
83 isolateDebugger(
false);
86 void setDebuggerBuffer(
unsigned int size)
89 m_dataLoad->setDebuggerBuffer(size);
91 std::string getDebuggerBuffer()
94 return m_dataLoad->getDebuggerBuffer();
97 void suspendDebugger(
bool suspend)
101 m_dataLoad->suspendIngest(suspend);
103 m_debugState |= DEBUG_SUSPENDED;
105 m_debugState &= ~(
unsigned int)DEBUG_SUSPENDED;
108 void isolateDebugger(
bool isolate)
112 m_dataLoad->isolate(isolate);
114 m_debugState |= DEBUG_ISOLATED;
116 m_debugState &= ~(
unsigned int)DEBUG_ISOLATED;
119 void stepDebugger(
unsigned int steps)
122 m_dataLoad->stepDebugger(steps);
124 void replayDebugger()
127 m_dataLoad->replayDebugger();
130 bool debuggerAttached()
132 return m_debugState & DEBUG_ATTACHED;
136 return m_allowDebugger;
142 void createConfigCategories(
DefaultConfigCategory configCategory, std::string parent_name,std::string current_name);
143 void restartPlugin();
146 std::string controlSource();
147 bool sendToService(
const std::string& southService,
const std::string& name,
const std::string& value);
148 bool sendToDispatcher(
const std::string& path,
const std::string& payload);
152 std::string m_pluginName;
155 volatile bool m_shutdown;
160 std::condition_variable m_cv;
162 bool m_restartPlugin;
163 const std::string m_token;
166 bool m_requestRestart;
169 unsigned int m_debugState;
171 bool m_allowDebugger;
183 void asJSON(std::string &json)
const
187 json =
"\"debug\" : " + m_north->
debugState();
DefaultConfigCategory.
Definition: config_category.h:241
void clearFailures()
Clear the failure alert for sending data.
Definition: north.cpp:1370
Definition: data_sender.h:25
Definition: json_provider.h:14
void stop()
Stop the storage service/.
Definition: north.cpp:625
void start(std::string &coreAddress, unsigned short corePort)
Start the north service.
Definition: north.cpp:352
Class that represents a north plugin.
Definition: north_plugin.h:33
std::string debugState()
Return the state of the pipeline debugger.
Definition: north.cpp:1382
void restart()
Restart request.
Definition: north.cpp:794
void shutdown()
Shutdown request.
Definition: north.cpp:779
void alertFailures()
Raise an alert that we are having issues sending data.
Definition: north.cpp:1356
A class used in the North service to load data from the buffer.
Definition: data_load.h:24
Definition: config_category.h:56
void configChange(const std::string &, const std::string &)
Configuration change notification.
Definition: north.cpp:811
virtual ~NorthService()
Destructor for the north service.
Definition: north.cpp:324
Client for accessing the storage service.
Definition: storage_client.h:43
NorthService(const std::string &name, const std::string &token="")
Constructor for the north service.
Definition: north.cpp:297
A data provider class to return data in the north service ping response.
Definition: north_service.h:179
Definition: plugin_data.h:15
Fledge Logger class used to log to syslog.
Definition: logger.h:42
The AssetTracker class provides the asset tracking functionality.
Definition: asset_tracking.h:239
The NorthService class.
Definition: north_service.h:42
ServiceAuthHandler adds security to the base class ServiceHandler.
Definition: service_handler.h:35
A singleton class for access to the audit logger within services.
Definition: audit_logger.h:21