ZeroTierOne/nonfree/controller/ControllerChangeNotifier.cpp
Grant Limberg 6113bad61e
Some checks failed
/ build_macos (push) Has been cancelled
/ build_windows (push) Has been cancelled
/ Central Controller Build (push) Has been cancelled
/ build_ubuntu (push) Has been cancelled
/ multi-arch-docker (push) Has been cancelled
make pubsub topics configurable
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.
2025-09-18 09:33:04 -07:00

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