-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Multipoint Groups and telemetry (#288)
* Add gRPC based API to interface with MCM Agent. * Add Manager to control the life cycle of Multipoint Groups. * Add basic support for Bridges. * Add Manager to control the life cycle of Bridges. * Add metrics to the connection base class to support telemetry. * Add metric collector engine to support telemetry. * Add printing call stack when the app crashes. * Minor fixes to the build system. Signed-off-by: Konstantin Ilichev <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,852 additions
and
558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright (c) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#ifndef MANAGER_BRIDGES_H | ||
#define MANAGER_BRIDGES_H | ||
|
||
#include <string> | ||
#include "concurrency.h" | ||
#include "conn_registry.h" | ||
|
||
namespace mesh::connection { | ||
|
||
class BridgesManager { | ||
public: | ||
int create_bridge(context::Context& ctx, Connection*& bridge, | ||
const std::string& id, Kind kind); | ||
|
||
int delete_bridge(context::Context& ctx, const std::string& id); | ||
|
||
Connection * get_bridge(context::Context& ctx, const std::string& id); | ||
|
||
void shutdown(context::Context& ctx); | ||
|
||
void lock(); | ||
void unlock(); | ||
|
||
private: | ||
Registry registry; // This regustry uses Agent assigned ids | ||
std::shared_mutex mx; | ||
}; | ||
|
||
extern BridgesManager bridges_manager; | ||
|
||
} // namespace mesh::connection | ||
|
||
#endif // MANAGER_BRIDGES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#ifndef MANAGER_MULTIPOINT_H | ||
#define MANAGER_MULTIPOINT_H | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <unordered_map> | ||
#include <mutex> | ||
#include <shared_mutex> | ||
#include <memory> | ||
#include <iostream> | ||
#include "multipoint.h" | ||
|
||
namespace mesh::multipoint { | ||
|
||
class GroupChangeConfig { | ||
public: | ||
std::string group_id; | ||
std::vector<std::string> added_conn_ids; | ||
std::vector<std::string> deleted_conn_ids; | ||
std::vector<std::string> added_bridge_ids; | ||
std::vector<std::string> deleted_bridge_ids; | ||
}; | ||
|
||
class GroupConfig { | ||
public: | ||
std::vector<std::string> conn_ids; | ||
std::vector<std::string> bridge_ids; | ||
}; | ||
|
||
class Config { | ||
public: | ||
std::unordered_map<std::string, GroupConfig> groups; | ||
}; | ||
|
||
class GroupManager { | ||
public: | ||
Result apply_config(context::Context& ctx, const Config& new_cfg); | ||
Result reconcile_config(context::Context& ctx, | ||
std::vector<GroupChangeConfig> added_groups, | ||
std::vector<GroupChangeConfig> deleted_groups, | ||
std::vector<GroupChangeConfig> updated_groups); | ||
private: | ||
Result associate(context::Context& ctx, Group *group, Connection *conn); | ||
|
||
int add_group(const std::string& id, Group *group) { | ||
std::unique_lock lk(mx); | ||
if (groups.contains(id)) | ||
return -1; | ||
groups[id] = group; | ||
return 0; | ||
} | ||
|
||
bool delete_group(const std::string& id) { | ||
std::unique_lock lk(mx); | ||
return groups.erase(id) > 0; | ||
} | ||
|
||
Group * get_group(const std::string& id) { | ||
std::shared_lock lk(mx); | ||
auto it = groups.find(id); | ||
if (it != groups.end()) { | ||
return it->second; | ||
} | ||
return nullptr; | ||
} | ||
|
||
Config cfg; | ||
|
||
std::unordered_map<std::string, Group *> groups; | ||
std::shared_mutex mx; | ||
}; | ||
|
||
extern GroupManager group_manager; | ||
|
||
} // namespace mesh::multipoint | ||
|
||
#endif // MANAGER_MULTIPOINT_H |
Oops, something went wrong.