mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-10-08 22:35: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.
53 lines
No EOL
1.3 KiB
C++
53 lines
No EOL
1.3 KiB
C++
#ifndef CONTROLLERCHANGENOTIFIER_HPP
|
|
#define CONTROLLERCHANGENOTIFIER_HPP
|
|
|
|
#include <memory>
|
|
#include <nlohmann/json.hpp>
|
|
#include <string>
|
|
|
|
namespace ZeroTier {
|
|
|
|
class PubSubWriter;
|
|
|
|
class ControllerChangeNotifier {
|
|
public:
|
|
virtual ~ControllerChangeNotifier() = default;
|
|
|
|
virtual void notifyNetworkChange(
|
|
const nlohmann::json& oldNetwork,
|
|
const nlohmann::json& newNetwork,
|
|
const std::string& frontend = "") = 0;
|
|
|
|
virtual void notifyMemberChange(
|
|
const nlohmann::json& oldMember,
|
|
const nlohmann::json newMember,
|
|
const std::string& frontend = "") = 0;
|
|
};
|
|
|
|
class PubSubChangeNotifier : public ControllerChangeNotifier {
|
|
public:
|
|
PubSubChangeNotifier(
|
|
std::string controllerID,
|
|
std::string project,
|
|
std::string memberChangeTopic,
|
|
std::string networkChangeTopic);
|
|
virtual ~PubSubChangeNotifier();
|
|
|
|
virtual void notifyNetworkChange(
|
|
const nlohmann::json& oldNetwork,
|
|
const nlohmann::json& newNetwork,
|
|
const std::string& frontend = "") override;
|
|
|
|
virtual void notifyMemberChange(
|
|
const nlohmann::json& oldMember,
|
|
const nlohmann::json newMember,
|
|
const std::string& frontend = "") override;
|
|
|
|
private:
|
|
std::shared_ptr<PubSubWriter> _networkChangeWriter;
|
|
std::shared_ptr<PubSubWriter> _memberChangeWriter;
|
|
};
|
|
|
|
} // namespace ZeroTier
|
|
|
|
#endif // CONTROLLERCHANGENOTIFIER_HPP
|