mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Broker Store updates: get a bit more infrastructure in place.
This compiles, but besides giving debug messages (and partially performing inserts/updates) it is not really helpful and definitely WIP. This also shows that I might have to re-think the approach that we will take here. So far, we actually insert tables as tables into Brokerstores. This opens up the potential to just have several tables synchronized via a single brokerstore. However, it turns out, that the current store_event API sends the complete table with each update. Which is problematic for obvious reasons - and not really sustainable.
This commit is contained in:
parent
8db83a5ed2
commit
558e89b3ba
5 changed files with 164 additions and 26 deletions
23
src/Val.cc
23
src/Val.cc
|
@ -2079,14 +2079,27 @@ void TableVal::SendToStore(const Val* index, const Val* new_value, OnChangeType
|
|||
if ( ! handle )
|
||||
return;
|
||||
|
||||
if ( index->AsListVal()->Length() != 1 )
|
||||
// we wither get passed the raw index_val - or a ListVal with exactly one element.
|
||||
// Since broker does not support ListVals, we have to unoll this in the second case.
|
||||
const Val* index_val;
|
||||
if ( index->Type()->Tag() == TYPE_LIST )
|
||||
{
|
||||
builtin_error("table with complex index not supported for &broker_store");
|
||||
return;
|
||||
if ( index->AsListVal()->Length() != 1 )
|
||||
{
|
||||
builtin_error("table with complex index not supported for &broker_store");
|
||||
return;
|
||||
}
|
||||
|
||||
index_val = index->AsListVal()->Index(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
index_val = index;
|
||||
}
|
||||
|
||||
const auto index_val = index->AsListVal()->Index(0);
|
||||
auto key_val = new StringVal("test");
|
||||
// FIXME: at the moment this is hardcoded to the name of the broker store. I needed something to be able to tell
|
||||
// me which store a change came from - and this still seems to be missing from the store_events. (Or I am blind).
|
||||
auto key_val = new StringVal(broker_store);
|
||||
auto broker_key = bro_broker::val_to_data(key_val);
|
||||
auto broker_index = bro_broker::val_to_data(index_val);
|
||||
Unref(key_val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue