diff --git a/src/Attr.cc b/src/Attr.cc index dd85a08b41..04905ef8d4 100644 --- a/src/Attr.cc +++ b/src/Attr.cc @@ -620,7 +620,7 @@ void Attributes::CheckAttr(Attr* a) } // Temporary since Broker does not support ListVals - and we cannot easily convert to set/vector - if ( type->AsTableType()->IndexTypes().size() != 1 ) + if ( type->AsTableType()->GetIndexTypes().size() != 1 ) { Error("&backend only supports one-element set/table indexes"); } @@ -655,7 +655,7 @@ void Attributes::CheckAttr(Attr* a) } // Temporary since Broker does not support ListVals - and we cannot easily convert to set/vector - if ( type->AsTableType()->IndexTypes().size() != 1 ) + if ( type->AsTableType()->GetIndexTypes().size() != 1 ) { Error("&broker_store only supports one-element set/table indexes"); } diff --git a/src/Val.cc b/src/Val.cc index f130ce720a..1945cdf5d7 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -2151,7 +2151,6 @@ void TableVal::CallChangeFunc(const ValPtr& index, in_change_func = false; } -<<<<<<< HEAD void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, OnChangeType tpe) { if ( broker_store.empty() || ! index ) @@ -2171,7 +2170,7 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, { if ( index->AsListVal()->Length() != 1 ) { - builtin_error("table with complex index not supported for &broker_store"); + zeek::emit_builtin_error("table with complex index not supported for &broker_store"); return; } @@ -2188,7 +2187,7 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, if ( ! broker_index ) { - builtin_error("invalid Broker data conversation for table index"); + zeek::emit_builtin_error("invalid Broker data conversation for table index"); return; } @@ -2224,14 +2223,14 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, { if ( ! new_entry_val ) { - builtin_error("did not receive new value for broker-store send operation"); + zeek::emit_builtin_error("did not receive new value for broker-store send operation"); return; } auto new_value = new_entry_val->GetVal().get(); auto broker_val = bro_broker::val_to_data(new_value); if ( ! broker_val ) { - builtin_error("invalid Broker data conversation for table value"); + zeek::emit_builtin_error("invalid Broker data conversation for table value"); return; } handle->store.put(std::move(*broker_index), std::move(*broker_val), expiry); @@ -2249,11 +2248,11 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, } catch ( InterpreterException& e ) { - builtin_error("The previous error was encountered while trying to resolve the &broker_store attribute of the set/table. Potentially the Broker::Store has not been initialized before being used."); + zeek::emit_builtin_error("The previous error was encountered while trying to resolve the &broker_store attribute of the set/table. Potentially the Broker::Store has not been initialized before being used."); } } -ValPtr TableVal::Remove(const Val& index, bool broker_forward)) +ValPtr TableVal::Remove(const Val& index, bool broker_forward) { auto k = MakeHashKey(index); // this is totally cheating around the fact that we need a Intrusive pointer. diff --git a/src/Val.h b/src/Val.h index ffa4d0eeb8..dd14abc9a1 100644 --- a/src/Val.h +++ b/src/Val.h @@ -1058,7 +1058,7 @@ protected: enum OnChangeType { ELEMENT_NEW, ELEMENT_CHANGED, ELEMENT_REMOVED, ELEMENT_EXPIRED }; // Calls &change_func. - void CallChangeFunc(const Val* index, const ValPtr& old_value, + void CallChangeFunc(const ValPtr& index, const ValPtr& old_value, OnChangeType tpe); // Sends data on to backing Broker Store diff --git a/src/broker/Manager.cc b/src/broker/Manager.cc index 6ae5a9c00b..e9918d11a1 100644 --- a/src/broker/Manager.cc +++ b/src/broker/Manager.cc @@ -222,7 +222,7 @@ void Manager::InitPostScript() void Manager::InitializeBrokerStoreForwarding() { - const auto& globals = global_scope()->Vars(); + const auto& globals = zeek::detail::global_scope()->Vars(); for ( const auto& global : globals ) { @@ -233,7 +233,7 @@ void Manager::InitializeBrokerStoreForwarding() auto e = static_cast(attr->GetExpr()->Eval(nullptr)->AsEnum()); auto storename = std::string("___sync_store_") + global.first; id->GetVal()->AsTableVal()->SetBrokerStore(storename); - AddForwardedStore(storename, {NewRef{}, id->GetVal()->AsTableVal()}); + AddForwardedStore(storename, {zeek::NewRef{}, id->GetVal()->AsTableVal()}); // we only create masters here. For clones, we do all the work of setting up // the forwarding - but we do not try to initialize the clone. We can only initialize @@ -1024,7 +1024,7 @@ void Manager::ProcessStoreEvent(const broker::topic& topic, broker::data msg) } // FIXME: expiry! - const auto& its = table->GetType()->AsTableType()->IndexTypes(); + const auto& its = table->GetType()->AsTableType()->GetIndexTypes(); assert( its.size() == 1 ); auto zeek_key = data_to_val(std::move(key), its[0].get()); if ( ! zeek_key ) @@ -1073,7 +1073,7 @@ void Manager::ProcessStoreEvent(const broker::topic& topic, broker::data msg) return; } - const auto& its = table->GetType()->AsTableType()->IndexTypes(); + const auto& its = table->GetType()->AsTableType()->GetIndexTypes(); assert( its.size() == 1 ); auto zeek_key = data_to_val(std::move(key), its[0].get()); if ( ! zeek_key ) @@ -1113,7 +1113,7 @@ void Manager::ProcessStoreEvent(const broker::topic& topic, broker::data msg) auto key = erase.key(); DBG_LOG(DBG_BROKER, "Store %s: Erase key %s", erase.store_id().c_str(), to_string(key).c_str()); - const auto& its = table->GetType()->AsTableType()->IndexTypes(); + const auto& its = table->GetType()->AsTableType()->GetIndexTypes(); assert( its.size() == 1 ); auto zeek_key = data_to_val(std::move(key), its[0].get()); if ( ! zeek_key ) @@ -1677,7 +1677,7 @@ void Manager::BrokerStoreToZeekTable(const std::string& name, const StoreHandleV auto set = caf::get_if(&(keys->get_data())); auto table = handle->forward_to; - const auto& its = table->GetType()->AsTableType()->IndexTypes(); + const auto& its = table->GetType()->AsTableType()->GetIndexTypes(); bool is_set = table->GetType()->IsSet(); assert( its.size() == 1 ); for ( const auto key : *set ) @@ -1804,7 +1804,7 @@ const Stats& Manager::GetStatistics() return statistics; } -bool Manager::AddForwardedStore(const std::string& name, IntrusivePtr table) +bool Manager::AddForwardedStore(const std::string& name, zeek::IntrusivePtr table) { if ( forwarded_stores.find(name) != forwarded_stores.end() ) { @@ -1812,7 +1812,7 @@ bool Manager::AddForwardedStore(const std::string& name, IntrusivePtr return false; } - DBG_LOG(DBG_BROKER, "Adding table forward for data store %s", name.c_str()); + DBG_LOG(DBG_BROKER, "Adding table forward for data store %s", name.c_str()); forwarded_stores.emplace(name, table); CheckForwarding(name); diff --git a/src/broker/Manager.h b/src/broker/Manager.h index a10e8220cb..513412affe 100644 --- a/src/broker/Manager.h +++ b/src/broker/Manager.h @@ -303,7 +303,7 @@ public: */ StoreHandleVal* LookupStore(const std::string& name); - bool AddForwardedStore(const std::string& name, IntrusivePtr table); + bool AddForwardedStore(const std::string& name, zeek::IntrusivePtr table); /** * Close and unregister a data store. Any existing references to the @@ -399,7 +399,7 @@ private: std::string default_log_topic_prefix; std::shared_ptr bstate; std::unordered_map data_stores; - std::unordered_map> forwarded_stores; + std::unordered_map> forwarded_stores; std::unordered_map pending_queries; std::vector forwarded_prefixes; diff --git a/src/broker/Store.h b/src/broker/Store.h index 3a8b9d853e..4e982b2c86 100644 --- a/src/broker/Store.h +++ b/src/broker/Store.h @@ -123,7 +123,7 @@ public: broker::store::proxy proxy; broker::publisher_id store_pid; // Zeek table that events are forwarded to. - IntrusivePtr forward_to; + zeek::IntrusivePtr forward_to; protected: