cluster/Backend: Rename HandleRemoteEvent() to ProcessEvent()

...also add Backend::ProcessEvent() for backends to trigger event
processing without needing to use ProcessEventMessage().
This commit is contained in:
Arne Welzel 2025-02-06 16:33:19 +01:00
parent 390a4fc1bb
commit f8ef5addaa
3 changed files with 26 additions and 8 deletions

View file

@ -102,7 +102,7 @@ public:
*
* @return true if the remote event was handled successfully, else false.
*/
bool HandleRemoteEvent(std::string_view topic, Event e) { return DoHandleRemoteEvent(topic, std::move(e)); }
bool ProcessEvent(std::string_view topic, Event e) { return DoProcessEvent(topic, std::move(e)); }
/**
* Method for enquing backend specific events.
@ -120,14 +120,14 @@ public:
private:
/**
* Hook method for implementing HandleRemoteEvent().
* Hook method for implementing ProcessEvent().
*
* @param topic The topic on which the event was received.
* @param ev The parsed event that was received.
*
* @return true if the remote event was handled successfully, else false.
*/
virtual bool DoHandleRemoteEvent(std::string_view topic, Event e) = 0;
virtual bool DoProcessEvent(std::string_view topic, Event e) = 0;
/**
* Hook method for implementing EnqueueLocalEvent().
@ -143,7 +143,7 @@ private:
*/
class LocalEventHandlingStrategy : public EventHandlingStrategy {
private:
bool DoHandleRemoteEvent(std::string_view topic, Event e) override;
bool DoProcessEvent(std::string_view topic, Event e) override;
void DoEnqueueLocalEvent(EventHandlerPtr h, zeek::Args args) override;
};
@ -308,6 +308,20 @@ protected:
*/
void EnqueueEvent(EventHandlerPtr h, zeek::Args args);
/**
* Process a cluster event.
*
* This method is called by ProcessEventMessage() and delegates
* to the event handling strategy. It should only be used by
* backends implementing their own serialization format. Other
* backends should not have a use for this and call ProcessEventMessage()
* directly instead.
*
* @param topic The topic on which the event was received.
* @param e The event as cluster::detail::Event.
*/
bool ProcessEvent(std::string_view topic, detail::Event e);
/**
* Process an incoming event message.
*/