mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
broker/Eventhandler: Deprecate Broker::auto_publish() for v8.1
Relates to #3637
This commit is contained in:
parent
455e05bc2e
commit
6abb9d7eda
6 changed files with 29 additions and 5 deletions
4
NEWS
4
NEWS
|
@ -109,6 +109,10 @@ Removed Functionality
|
||||||
Deprecated Functionality
|
Deprecated Functionality
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
* The ``Broker::auto_publish()`` function has been deprecated and should
|
||||||
|
be replaced with explicit ``Broker::publish()`` invocations that are
|
||||||
|
potentially guarded with appropriate ``@if`` or ``@ifdef`` directives.
|
||||||
|
|
||||||
Zeek 7.0.0
|
Zeek 7.0.0
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ export {
|
||||||
## ev: a Zeek event value.
|
## ev: a Zeek event value.
|
||||||
##
|
##
|
||||||
## Returns: true if automatic event sending is now enabled.
|
## Returns: true if automatic event sending is now enabled.
|
||||||
global auto_publish: function(topic: string, ev: any): bool;
|
global auto_publish: function(topic: string, ev: any): bool &deprecated="Remove in v8.1. Switch to explicit Broker::publish() calls. Auto-publish won't work with all cluster backends.";
|
||||||
|
|
||||||
## Stop automatically sending an event to peers upon local dispatch.
|
## Stop automatically sending an event to peers upon local dispatch.
|
||||||
##
|
##
|
||||||
|
@ -405,7 +405,7 @@ export {
|
||||||
##
|
##
|
||||||
## Returns: true if automatic events will not occur for the topic/event
|
## Returns: true if automatic events will not occur for the topic/event
|
||||||
## pair.
|
## pair.
|
||||||
global auto_unpublish: function(topic: string, ev: any): bool;
|
global auto_unpublish: function(topic: string, ev: any): bool &deprecated="Remove in v8.1. See Broker::auto_publish()";
|
||||||
}
|
}
|
||||||
|
|
||||||
@load base/bif/comm.bif
|
@load base/bif/comm.bif
|
||||||
|
|
|
@ -35,9 +35,15 @@ public:
|
||||||
|
|
||||||
void SetFunc(FuncPtr f);
|
void SetFunc(FuncPtr f);
|
||||||
|
|
||||||
void AutoPublish(std::string topic) { auto_publish.insert(std::move(topic)); }
|
[[deprecated("Remove in v8.1, use explicit Publish().")]]
|
||||||
|
void AutoPublish(std::string topic) {
|
||||||
|
auto_publish.insert(std::move(topic));
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUnpublish(const std::string& topic) { auto_publish.erase(topic); }
|
[[deprecated("Remove in v8.1.")]]
|
||||||
|
void AutoUnpublish(const std::string& topic) {
|
||||||
|
auto_publish.erase(topic);
|
||||||
|
}
|
||||||
|
|
||||||
void Call(zeek::Args* vl, bool no_remote = false, double ts = run_state::network_time);
|
void Call(zeek::Args* vl, bool no_remote = false, double ts = run_state::network_time);
|
||||||
|
|
||||||
|
|
|
@ -811,7 +811,10 @@ bool Manager::AutoPublishEvent(string topic, Val* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG_LOG(DBG_BROKER, "Enabling auto-publishing of event %s to topic %s", handler->Name(), topic.c_str());
|
DBG_LOG(DBG_BROKER, "Enabling auto-publishing of event %s to topic %s", handler->Name(), topic.c_str());
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
handler->AutoPublish(std::move(topic));
|
handler->AutoPublish(std::move(topic));
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -837,7 +840,10 @@ bool Manager::AutoUnpublishEvent(const string& topic, Val* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG_LOG(DBG_BROKER, "Disabling auto-publishing of event %s to topic %s", handler->Name(), topic.c_str());
|
DBG_LOG(DBG_BROKER, "Disabling auto-publishing of event %s to topic %s", handler->Name(), topic.c_str());
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
handler->AutoUnpublish(topic);
|
handler->AutoUnpublish(topic);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,6 +243,7 @@ public:
|
||||||
* @param event a Zeek event value.
|
* @param event a Zeek event value.
|
||||||
* @return true if automatic event sending is now enabled.
|
* @return true if automatic event sending is now enabled.
|
||||||
*/
|
*/
|
||||||
|
[[deprecated("Remove in v8.1, use explicit Publish().")]]
|
||||||
bool AutoPublishEvent(std::string topic, Val* event);
|
bool AutoPublishEvent(std::string topic, Val* event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,6 +252,7 @@ public:
|
||||||
* @param event an event originally given to zeek::Broker::Manager::AutoPublish().
|
* @param event an event originally given to zeek::Broker::Manager::AutoPublish().
|
||||||
* @return true if automatic events will no occur for the topic/event pair.
|
* @return true if automatic events will no occur for the topic/event pair.
|
||||||
*/
|
*/
|
||||||
|
[[deprecated("Remove in v8.1.")]]
|
||||||
bool AutoUnpublishEvent(const std::string& topic, Val* event);
|
bool AutoUnpublishEvent(const std::string& topic, Val* event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -483,7 +485,7 @@ private:
|
||||||
telemetry::CounterPtr num_logs_outgoing_metric;
|
telemetry::CounterPtr num_logs_outgoing_metric;
|
||||||
telemetry::CounterPtr num_ids_incoming_metric;
|
telemetry::CounterPtr num_ids_incoming_metric;
|
||||||
telemetry::CounterPtr num_ids_outgoing_metric;
|
telemetry::CounterPtr num_ids_outgoing_metric;
|
||||||
};
|
}; // namespace zeek
|
||||||
|
|
||||||
} // namespace Broker
|
} // namespace Broker
|
||||||
|
|
||||||
|
|
|
@ -136,14 +136,20 @@ function Broker::__publish_id%(topic: string, id: string%): bool
|
||||||
function Broker::__auto_publish%(topic: string, ev: any%): bool
|
function Broker::__auto_publish%(topic: string, ev: any%): bool
|
||||||
%{
|
%{
|
||||||
zeek::Broker::Manager::ScriptScopeGuard ssg;
|
zeek::Broker::Manager::ScriptScopeGuard ssg;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
auto rval = zeek::broker_mgr->AutoPublishEvent(topic->CheckString(), ev);
|
auto rval = zeek::broker_mgr->AutoPublishEvent(topic->CheckString(), ev);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
return zeek::val_mgr->Bool(rval);
|
return zeek::val_mgr->Bool(rval);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
function Broker::__auto_unpublish%(topic: string, ev: any%): bool
|
function Broker::__auto_unpublish%(topic: string, ev: any%): bool
|
||||||
%{
|
%{
|
||||||
zeek::Broker::Manager::ScriptScopeGuard ssg;
|
zeek::Broker::Manager::ScriptScopeGuard ssg;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
auto rval = zeek::broker_mgr->AutoUnpublishEvent(topic->CheckString(), ev);
|
auto rval = zeek::broker_mgr->AutoUnpublishEvent(topic->CheckString(), ev);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
return zeek::val_mgr->Bool(rval);
|
return zeek::val_mgr->Bool(rval);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue