refactor: implement all core services
This commit is contained in:
@@ -7,6 +7,12 @@
|
||||
#include "ApiServer.h"
|
||||
#include "TaskManager.h"
|
||||
|
||||
// Services
|
||||
#include "NodeService.h"
|
||||
#include "NetworkService.h"
|
||||
#include "ClusterService.h"
|
||||
#include "TaskService.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
NodeContext ctx({
|
||||
@@ -18,6 +24,12 @@ TaskManager taskManager(ctx);
|
||||
ClusterManager cluster(ctx, taskManager);
|
||||
ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port);
|
||||
|
||||
// Create services
|
||||
NodeService nodeService(ctx);
|
||||
NetworkService networkService(network);
|
||||
ClusterService clusterService(ctx);
|
||||
TaskService taskService(taskManager);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
@@ -27,7 +39,11 @@ void setup() {
|
||||
// Initialize and start all tasks
|
||||
taskManager.initialize();
|
||||
|
||||
// Start the API server
|
||||
// Register services and start API server
|
||||
apiServer.addService(nodeService);
|
||||
apiServer.addService(networkService);
|
||||
apiServer.addService(clusterService);
|
||||
apiServer.addService(taskService);
|
||||
apiServer.begin();
|
||||
|
||||
// Print initial task status
|
||||
|
||||
Reference in New Issue
Block a user