diff --git a/NEWS b/NEWS index 6297a75c8e..ec2bb7efe8 100644 --- a/NEWS +++ b/NEWS @@ -57,7 +57,7 @@ New Functionality - Broker Store table synchronization (Experimental). - Zeek now supports synchronizing tables/sets across clusters using a backing broker + Zeek now supports synchronizing tables/sets across clusters using a backing Broker store. The same feature also allows persistent storage of data in tables/sets over Zeek restarts. This feature is implemented using the new ```&backend``` attribute. diff --git a/scripts/base/frameworks/broker/store.zeek b/scripts/base/frameworks/broker/store.zeek index 8a9019bb40..23b4cccc4e 100644 --- a/scripts/base/frameworks/broker/store.zeek +++ b/scripts/base/frameworks/broker/store.zeek @@ -25,14 +25,14 @@ export { ## A negative/zero value indicates to never buffer commands. const default_clone_mutation_buffer_interval = 2min &redef; - ## If set to true, the current node is the master node for broker stores - ## backing zeek tables. By default this value will be automatically set to + ## If set to true, the current node is the master node for Broker stores + ## backing Zeek tables. By default this value will be automatically set to ## true in standalone mode, or on the manager node of a cluster. This value ## should not typically be changed manually. const auto_store_master = T &redef; - ## The directory used for storing persistent database files when using brokerstore - ## backed zeek tables. + ## The directory used for storing persistent database files when using Broker store + ## backed Zeek tables. const auto_store_db_directory = "." &redef; ## Whether a data store query could be completed or not. @@ -393,7 +393,7 @@ export { ## d: the communication data. ## ## Returns: The data type associated with the communication data. - ## Note that broker represents records in the same way as + ## Note that Broker represents records in the same way as ## vectors, so there is no "record" type. global data_type: function(d: Broker::Data): Broker::DataType; diff --git a/scripts/base/frameworks/cluster/broker-stores.zeek b/scripts/base/frameworks/cluster/broker-stores.zeek index 1513e6776d..bf84f378e5 100644 --- a/scripts/base/frameworks/cluster/broker-stores.zeek +++ b/scripts/base/frameworks/cluster/broker-stores.zeek @@ -1,9 +1,9 @@ -##! This script deals with the cluster parts of broker backed zeek tables. +##! This script deals with the cluster parts of Broker backed Zeek tables. ##! It makes sure that the master store is set correctly and that clones ##! are automatically created on the non-manager nodes. # Note - this script should become unnecessary in the future, when we just can -# speculatively attach clones. This should be possible once the new ALM broker +# speculatively attach clones. This should be possible once the new ALM Broker # transport becomes available. @load ./main @@ -11,8 +11,8 @@ module Broker; export { - ## Event that is used by the manager to announce the master stores for zeek backed - ## tables that is uses. + ## Event that is used by the manager to announce the master stores for Broker backed + ## tables. global announce_masters: event(masters: set[string]); } diff --git a/scripts/base/init-bare.zeek b/scripts/base/init-bare.zeek index 87c24b6eae..3534f2aac7 100644 --- a/scripts/base/init-bare.zeek +++ b/scripts/base/init-bare.zeek @@ -747,7 +747,7 @@ type script_id: record { enum_constant: bool; ##< True if the identifier is an enum value. option_value: bool; ##< True if the identifier is an option. redefinable: bool; ##< True if the identifier is declared with the :zeek:attr:`&redef` attribute. - broker_backend: bool; ##< True if the identifier has a broker backend defined using the :zeek:attr:`&backend` attribute. + broker_backend: bool; ##< True if the identifier has a Broker backend defined using the :zeek:attr:`&backend` attribute. value: any &optional; ##< The current value of the identifier. }; diff --git a/src/Attr.h b/src/Attr.h index 664a73386f..952bb7a92a 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -42,9 +42,9 @@ enum AttrTag { ATTR_TYPE_COLUMN, // for input framework ATTR_TRACKED, // hidden attribute, tracked by NotifierRegistry ATTR_ON_CHANGE, // for table change tracking - ATTR_BROKER_STORE, // for broker-store backed tables - ATTR_BROKER_STORE_ALLOW_COMPLEX, // for broker-store backed tables - ATTR_BACKEND, // for broker-store backed tabled + ATTR_BROKER_STORE, // for Broker store backed tables + ATTR_BROKER_STORE_ALLOW_COMPLEX, // for Broker store backed tables + ATTR_BACKEND, // for Broker store backed tabled ATTR_DEPRECATED, NUM_ATTRS // this item should always be last }; diff --git a/src/Val.cc b/src/Val.cc index 133ecad543..f70adf0cc1 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -2164,7 +2164,7 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, return; // we either 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. + // Since Broker does not support ListVals, we have to unoll this in the second case. const Val* index_val; if ( index->GetType()->Tag() == zeek::TYPE_LIST ) { @@ -2221,7 +2221,7 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, { if ( ! new_entry_val ) { - zeek::emit_builtin_error("did not receive new value for broker-store send operation"); + zeek::emit_builtin_error("did not receive new value for Broker datastore send operation"); return; } auto new_value = new_entry_val->GetVal().get(); @@ -2239,7 +2239,7 @@ void TableVal::SendToStore(const Val* index, const TableEntryVal* new_entry_val, handle->store.erase(std::move(*broker_index)); break; case ELEMENT_EXPIRED: - // we do nothing here. The broker store does its own expiration - so the element + // we do nothing here. The Broker store does its own expiration - so the element // should expire at about the same time. break; } diff --git a/src/Val.h b/src/Val.h index ef02fbc3f3..40d35cc58c 100644 --- a/src/Val.h +++ b/src/Val.h @@ -785,7 +785,7 @@ public: * @param new_val The value to assign at the index. For a set, this * must be nullptr. * @param broker_forward Controls if the value will be forwarded to attached - * broker stores. + * Broker stores. * @return True if the assignment type-checked. */ bool Assign(ValPtr index, ValPtr new_val, bool broker_forward = true); @@ -799,7 +799,7 @@ public: * @param new_val The value to assign at the index. For a set, this * must be nullptr. * @param broker_forward Controls if the value will be forwarded to attached - * broker stores. + * Broker stores. * @return True if the assignment type-checked. */ bool Assign(ValPtr index, std::unique_ptr k, @@ -926,7 +926,7 @@ public: * Remove an element from the table and return it. * @param index The index to remove. * @param broker_forward Controls if the remove operation will be forwarded to attached - * broker stores. + * Broker stores. * @return The value associated with the index if it exists, else nullptr. * For a sets that don't really contain associated values, a placeholder * value is returned to differentiate it from non-existent index (nullptr), @@ -1024,7 +1024,7 @@ public: static void DoneParsing(); /** - * Sets the name of the broker store that is backing this table. + * Sets the name of the Broker store that is backing this table. * @param store store that is backing this table. */ void SetBrokerStore(const std::string& store) { broker_store = store; } diff --git a/src/broker/Manager.cc b/src/broker/Manager.cc index 4ba4a34aef..fa9a14788d 100644 --- a/src/broker/Manager.cc +++ b/src/broker/Manager.cc @@ -235,7 +235,7 @@ void Manager::InitializeBrokerStoreForwarding() id->GetVal()->AsTableVal()->SetBrokerStore(storename); AddForwardedStore(storename, {zeek::NewRef{}, id->GetVal()->AsTableVal()}); - // we only create masters here. For clones, we do all the work of setting up + // 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 // the clone, once a node has a connection to a master. This is currently done in scriptland // in scripts/base/frameworks/cluster/broker-stores.zeek. Once the ALM transport is ready @@ -921,7 +921,6 @@ void Manager::Process() { // Ensure that time gets update before processing broker messages, or events // based on them might get scheduled wrong. - // Fixme: unclear if final solution - see https://github.com/zeek/broker/issues/135 if ( use_real_time ) net_update_time(current_time()); @@ -1700,14 +1699,14 @@ void Manager::BrokerStoreToZeekTable(const std::string& name, const StoreHandleV auto value = handle->store.get(key); if ( ! value ) { - reporter->Error("Failed to load value for key %s while importing broker store %s to table", to_string(key).c_str(), name.c_str()); + reporter->Error("Failed to load value for key %s while importing Broker store %s to table", to_string(key).c_str(), name.c_str()); continue; } auto zeek_value = data_to_val(*value, table->GetType()->Yield().get()); if ( ! zeek_value ) { - reporter->Error("Could not convert %s to table value while trying to import broker store %s. Aborting import.", to_string(value).c_str(), name.c_str()); + reporter->Error("Could not convert %s to table value while trying to import Broker store %s. Aborting import.", to_string(value).c_str(), name.c_str()); return; } diff --git a/src/broker/Manager.h b/src/broker/Manager.h index 18b6921641..8274d172bb 100644 --- a/src/broker/Manager.h +++ b/src/broker/Manager.h @@ -304,12 +304,12 @@ public: StoreHandleVal* LookupStore(const std::string& name); /** - * Register a zeek table that is associated with a broker store that is backing it. This - * causes all changes that happen to the brokerstore in the future to be applied to the zeek + * Register a Zeek table that is associated with a Broker store that is backing it. This + * causes all changes that happen to the Broker store in the future to be applied to theZzeek * table. - * A single broker store can only be forwarded to a single table. - * @param name name of the broker store - * @param table pointer to the table/set that is being backed + * A single Broker store can only be forwarded to a single table. + * @param name name of the Broker store. + * @param table pointer to the table/set that is being backed. * @return true on success, false if the named store is already being forwarded. */ bool AddForwardedStore(const std::string& name, zeek::IntrusivePtr table); @@ -359,7 +359,7 @@ public: private: void DispatchMessage(const broker::topic& topic, broker::data msg); - // Process events used for broker store backed zeek tables + // Process events used for Broker store backed zeek tables void ProcessStoreEvent(broker::data msg); void ProcessEvent(const broker::topic& topic, broker::zeek::Event ev); bool ProcessLogCreate(broker::zeek::LogCreate lc); @@ -369,11 +369,11 @@ private: void ProcessError(broker::error err); void ProcessStoreResponse(StoreHandleVal*, broker::store::response response); void FlushPendingQueries(); - // Initializes the masters for broker backed zeek tables when using the &backend attribute + // Initializes the masters for Broker backed Zeek tables when using the &backend attribute void InitializeBrokerStoreForwarding(); - // Check if a broker store is associated to a table on the Zeek side. + // Check if a Broker store is associated to a table on the Zeek side. void CheckForwarding(const std::string& name); - // Send the content of a broker store to the backing table. This is typically used + // Send the content of a Broker store to the backing table. This is typically used // when a master/clone is created. void BrokerStoreToZeekTable(const std::string& name, const StoreHandleVal* handle); diff --git a/src/broker/Store.h b/src/broker/Store.h index 4e982b2c86..191a3e7f1f 100644 --- a/src/broker/Store.h +++ b/src/broker/Store.h @@ -49,7 +49,7 @@ inline zeek::RecordValPtr query_result(zeek::RecordValPtr data) /** * Convert an expiry from a double (used to Zeek) to the format required by Broker * @param e: expire interval as double; 0 if no expiry - * @return expire interval in broker format + * @return expire interval in Broker format */ static broker::optional convert_expiry(double e) { diff --git a/testing/btest/broker/store/brokerstore-attr-expire.zeek b/testing/btest/broker/store/brokerstore-attr-expire.zeek index 42408fb740..f43be15deb 100644 --- a/testing/btest/broker/store/brokerstore-attr-expire.zeek +++ b/testing/btest/broker/store/brokerstore-attr-expire.zeek @@ -1,5 +1,5 @@ # So - this test currently is not really that great. The goal was to test expiration after -# syncing values with broker. However, it turns out that the delays introduced by broker seem +# syncing values with Broker. However, it turns out that the delays introduced by Broker seem # a bit random - and too high to really test this without the test taking forever. # # so - instead we just check that expiries do indeed happen - however the ordering is not as