mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
cluster: Rename setup-connections to setup-subscriptions
Now that all the logic about establishing connections among nodes has moved to the broker policy script, the setup-connections name seems unfortunate, transition away from it.
This commit is contained in:
parent
351bd7b81b
commit
d122894d0d
6 changed files with 52 additions and 49 deletions
46
scripts/base/frameworks/cluster/setup-subscriptions.zeek
Normal file
46
scripts/base/frameworks/cluster/setup-subscriptions.zeek
Normal file
|
@ -0,0 +1,46 @@
|
|||
##! This script contains the common subscription setup logic.
|
||||
@load ./main
|
||||
@load ./pools
|
||||
|
||||
module Cluster;
|
||||
|
||||
event zeek_init() &priority=-5
|
||||
{
|
||||
if ( getenv("ZEEKCTL_CHECK_CONFIG") != "" )
|
||||
return;
|
||||
|
||||
local self = nodes[node];
|
||||
|
||||
for ( i in registered_pools )
|
||||
{
|
||||
local pool = registered_pools[i];
|
||||
|
||||
if ( node in pool$nodes )
|
||||
Cluster::subscribe(pool$spec$topic);
|
||||
}
|
||||
|
||||
switch ( self$node_type ) {
|
||||
case NONE:
|
||||
return;
|
||||
case CONTROL:
|
||||
break;
|
||||
case LOGGER:
|
||||
Cluster::subscribe(Cluster::logger_topic);
|
||||
break;
|
||||
case MANAGER:
|
||||
Cluster::subscribe(Cluster::manager_topic);
|
||||
break;
|
||||
case PROXY:
|
||||
Cluster::subscribe(Cluster::proxy_topic);
|
||||
break;
|
||||
case WORKER:
|
||||
Cluster::subscribe(Cluster::worker_topic);
|
||||
break;
|
||||
default:
|
||||
Reporter::error(fmt("Unhandled cluster node type: %s", self$node_type));
|
||||
return;
|
||||
}
|
||||
|
||||
Cluster::subscribe(nodeid_topic(Cluster::node_id()));
|
||||
Cluster::subscribe(node_topic(node));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue