mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Zeek/Brokerstore updates: first working end-to-end test
This commit fixes a few more loose ends to actually make the Zeek Table<->brokerstore syncing work. This mostly slightly changes the TableVal assign/remove operators to prevent loops when a remote change arrives. The tests inserts a value into a table on the manager, and it pops out in a table on a clone - which is the easiest case. Timeouts are still not handled at all; the behavior when inserting into a clone is untested.
This commit is contained in:
parent
62f208086c
commit
65c12ba6e9
6 changed files with 166 additions and 62 deletions
12
src/Val.h
12
src/Val.h
|
@ -772,9 +772,11 @@ public:
|
|||
* @param index The key to assign.
|
||||
* @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.
|
||||
* @return True if the assignment type-checked.
|
||||
*/
|
||||
bool Assign(IntrusivePtr<Val> index, IntrusivePtr<Val> new_val);
|
||||
bool Assign(IntrusivePtr<Val> index, IntrusivePtr<Val> new_val, bool broker_forward = true);
|
||||
|
||||
/**
|
||||
* Assigns a value at an associated index in the table (or in the
|
||||
|
@ -784,10 +786,12 @@ public:
|
|||
* @param k A precomputed hash key to use.
|
||||
* @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.
|
||||
* @return True if the assignment type-checked.
|
||||
*/
|
||||
bool Assign(IntrusivePtr<Val> index, std::unique_ptr<HashKey> k,
|
||||
IntrusivePtr<Val> new_val);
|
||||
IntrusivePtr<Val> new_val, bool broker_forward = true);
|
||||
|
||||
// Returns true if the assignment typechecked, false if not. The
|
||||
// methods take ownership of new_val, but not of the index. If we're
|
||||
|
@ -909,12 +913,14 @@ 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.
|
||||
* @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),
|
||||
* but otherwise has no meaning in relation to the set's contents.
|
||||
*/
|
||||
IntrusivePtr<Val> Remove(const Val& index);
|
||||
IntrusivePtr<Val> Remove(const Val& index, bool broker_forward = true);
|
||||
|
||||
/**
|
||||
* Same as Remove(const Val&), but uses a precomputed hash key.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue