Merge remote-tracking branch 'origin/topic/awelzel/deprecate-broker-auto-publish'

* origin/topic/awelzel/deprecate-broker-auto-publish:
  sumstats: Remove copy() for Broker::publish() calls
  broker/Publish: Use event time instead of network time
  broker/Eventhandler: Deprecate Broker::auto_publish() for v8.1
  btest: Remove Broker::auto_publish() usages
  frameworks/control: Remove Broker::auto_publish()
  catch-and-release: Remove Broker::auto_publish()
  ssl/validate-certs: Remove Broker::auto_publish()
  sumstats: Remove Broker::auto_publish()
  cluster_started: No Broker::auto_publish() use
  openflow: Remove Broker::auto_publish()
  dhcp: Remove Broker::auto_publish()
  frameworks/notice: Remove Broker::auto_publish()
  netcontrol: Replace Broker::auto_publish()
  intel: Switch to Cluster::publish()
  broker: Support publish() of unspecified set() / table()
  types: Fix table() resulting in table_type->IsSet() == true
This commit is contained in:
Arne Welzel 2024-11-14 14:15:24 +01:00
commit 18bfdb8a2b
47 changed files with 705 additions and 279 deletions

View file

@ -51,15 +51,6 @@ event fully_connected(n: string)
terminate();
}
}
else
{
print "sent fully_connected event";
}
}
event zeek_init()
{
Broker::auto_publish(Cluster::logger_topic, fully_connected);
}
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
@ -74,16 +65,14 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
print "termination condition met: shutting down";
terminate();
}
return;
}
else if ( Cluster::node == "manager-1" )
local expected_nodes = Cluster::node == "manager-1" ? 5 : 4;
if ( peer_count == expected_nodes )
{
if ( peer_count == 5 )
event fully_connected(Cluster::node);
}
else
{
if ( peer_count == 4 )
event fully_connected(Cluster::node);
Broker::publish(Cluster::logger_topic, fully_connected, Cluster::node);
print "sent fully_connected event";
}
}

View file

@ -28,8 +28,6 @@ redef Cluster::nodes = {
};
@TEST-END-FILE
global fully_connected: event();
global peer_count = 0;
global fully_connected_nodes = 0;
@ -49,11 +47,6 @@ event fully_connected()
}
}
event zeek_init()
{
Broker::auto_publish(Cluster::manager_topic, fully_connected);
}
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
{
print "Connected to a peer";
@ -67,7 +60,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
else
{
if ( peer_count == 3 )
event fully_connected();
Broker::publish(Cluster::manager_topic, fully_connected);
}
}

View file

@ -36,13 +36,6 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
terminate();
}
global ready_for_data: event();
event zeek_init()
{
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
}
@if ( Cluster::node == "worker-1" )
event Cluster::Experimental::cluster_started()
{

View file

@ -38,10 +38,6 @@ global n = 0;
event ready_for_data()
{
@if ( Cluster::node == "manager-1" )
Config::set_value("testcount", 1);
@endif
@if ( Cluster::node == "worker-1" )
Config::set_value("testport", 44/tcp);
Config::set_value("teststring", "b", "comment");
@ -66,7 +62,6 @@ function option_changed(ID: string, new_value: any, location: string): any
event zeek_init() &priority=5
{
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
Option::set_change_handler("testport", option_changed, -100);
Option::set_change_handler("teststring", option_changed, -100);
Option::set_change_handler("testcount", option_changed, -100);
@ -79,9 +74,11 @@ event Cluster::node_up(name: string, id: string) &priority=-5
{
++peer_count;
if ( peer_count == 1 )
event ready_for_data();
{
Config::set_value("testcount", 1);
Broker::publish(Cluster::worker_topic, ready_for_data);
}
}
@endif
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)

View file

@ -50,9 +50,7 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
terminate();
}
global ready_for_data: event();
event ready_for_data()
event ready_for_data() &is_used
{
if ( Cluster::node == "worker-1" )
{
@ -74,8 +72,6 @@ event ready_for_data()
SumStats::observe("test", [$host=7.2.1.5], [$num=91]);
SumStats::observe("test", [$host=10.10.10.10], [$num=5]);
}
did_data = T;
}
@if ( Cluster::local_node_type() == Cluster::MANAGER )
@ -91,7 +87,8 @@ event second_test()
event send_ready_for_data()
{
print "Sending ready for data";
event ready_for_data();
Broker::publish(Cluster::worker_topic, ready_for_data);
did_data = T;
}
@ -104,10 +101,4 @@ event Cluster::Experimental::cluster_started()
schedule 5secs { send_ready_for_data() };
schedule 10secs { second_test() };
}
event zeek_init() &priority=100
{
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
}
@endif