mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-10-09 14:55:06 +02:00
Also for pubsub trips back to CV1/CV2, rather than having 2 queues for each service (networks & members), theres now only a single queue for each change type, and `frontend = (cv1|cv2)` attribute is set on the message for filtering.
38 lines
No EOL
1,011 B
C++
38 lines
No EOL
1,011 B
C++
#include "ControllerChangeNotifier.hpp"
|
|
|
|
#include "PubSubWriter.hpp"
|
|
|
|
namespace ZeroTier {
|
|
|
|
PubSubChangeNotifier::PubSubChangeNotifier(
|
|
std::string controllerID,
|
|
std::string project,
|
|
std::string memberChangeTopic,
|
|
std::string networkChangeTopic)
|
|
: ControllerChangeNotifier()
|
|
, _networkChangeWriter(std::make_shared<PubSubWriter>(project, networkChangeTopic, controllerID))
|
|
, _memberChangeWriter(std::make_shared<PubSubWriter>(project, memberChangeTopic, controllerID))
|
|
{
|
|
}
|
|
|
|
PubSubChangeNotifier::~PubSubChangeNotifier()
|
|
{
|
|
}
|
|
|
|
void PubSubChangeNotifier::notifyNetworkChange(
|
|
const nlohmann::json& oldNetwork,
|
|
const nlohmann::json& newNetwork,
|
|
const std::string& frontend)
|
|
{
|
|
_networkChangeWriter->publishNetworkChange(oldNetwork, newNetwork, frontend);
|
|
}
|
|
|
|
void PubSubChangeNotifier::notifyMemberChange(
|
|
const nlohmann::json& oldMember,
|
|
const nlohmann::json newMember,
|
|
const std::string& frontend)
|
|
{
|
|
_memberChangeWriter->publishMemberChange(oldMember, newMember, frontend);
|
|
}
|
|
|
|
} // namespace ZeroTier
|