mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
BrokerStore<->Zeek tables: &backend works for in-memory stores.
Currently this requires using this with a normal cluster - or sending messages by yourself. It, in principle, should also work with SQLITE - but that is a bit nonsensical without being able to change the storage location.
This commit is contained in:
parent
318a72c303
commit
a220b02722
9 changed files with 118 additions and 33 deletions
|
@ -49,5 +49,7 @@ redef Broker::log_topic = Cluster::rr_log_topic;
|
|||
@load ./nodes/worker
|
||||
@endif
|
||||
|
||||
@load ./broker-stores.zeek
|
||||
|
||||
@endif
|
||||
@endif
|
||||
|
|
46
scripts/base/frameworks/cluster/broker-stores.zeek
Normal file
46
scripts/base/frameworks/cluster/broker-stores.zeek
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
module Broker;
|
||||
|
||||
export {
|
||||
global announce_masters: event(masters: set[string]);
|
||||
}
|
||||
|
||||
@if ( Cluster::is_enabled() && Cluster::local_node_type() != Cluster::MANAGER )
|
||||
redef Broker::auto_store_master = F;
|
||||
@endif
|
||||
|
||||
@if ( Broker::auto_store_master )
|
||||
|
||||
global broker_backed_ids: set[string];
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local globals = global_ids();
|
||||
for ( id in globals )
|
||||
{
|
||||
if ( globals[id]$broker_backend )
|
||||
add broker_backed_ids[id];
|
||||
}
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string) &priority=1
|
||||
{
|
||||
if ( ! Cluster::is_enabled() )
|
||||
return;
|
||||
|
||||
local e = Broker::make_event(Broker::announce_masters, broker_backed_ids);
|
||||
Broker::publish(Cluster::nodeid_topic(endpoint$id), e);
|
||||
}
|
||||
|
||||
@else
|
||||
|
||||
event Broker::announce_masters(masters: set[string])
|
||||
{
|
||||
for ( i in masters )
|
||||
{
|
||||
local name = "___sync_store_" + i;
|
||||
Broker::create_clone(name);
|
||||
}
|
||||
}
|
||||
|
||||
@endif
|
|
@ -249,10 +249,6 @@ export {
|
|||
global nodeid_topic: function(id: string): string;
|
||||
}
|
||||
|
||||
@if ( Cluster::is_enabled() && Cluster::local_node_type() != Cluster::MANAGER ) )
|
||||
redef Broker::store_master = T;
|
||||
@endif
|
||||
|
||||
global active_worker_ids: set[string] = set();
|
||||
|
||||
type NamedNode: record {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue