cluster/Backend: Pass node_id via Init()

This commit is contained in:
Arne Welzel 2025-01-13 19:45:08 +01:00
parent 0b7a660a34
commit 769044e8e1
3 changed files with 20 additions and 4 deletions

View file

@ -149,8 +149,14 @@ public:
/**
* Method invoked from the Cluster::Backend::__init() bif.
*
* @param nid The node identifier to use.
*/
bool Init() { return DoInit(); }
bool Init(std::string nid) {
node_id = std::move(nid);
return DoInit();
}
/**
* Hook invoked when Zeek is about to terminate.
@ -209,6 +215,11 @@ public:
return DoPublishLogWrites(header, records);
}
/**
* @return This backend's node identifier.
*/
const std::string& NodeId() const { return node_id; }
protected:
/**
* Constructor.
@ -362,6 +373,11 @@ private:
std::unique_ptr<EventSerializer> event_serializer;
std::unique_ptr<LogSerializer> log_serializer;
std::unique_ptr<detail::EventHandlingStrategy> event_handling_strategy;
/**
* The backend's instance cluster node identifier.
*/
std::string node_id;
};
/**