mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Beginning implementation of &on_change for tables.
This commit is contained in:
parent
f6a1a7053b
commit
bf31587c2c
7 changed files with 92 additions and 2 deletions
14
src/Val.cc
14
src/Val.cc
|
@ -1340,6 +1340,7 @@ TableVal::~TableVal()
|
|||
Unref(def_val);
|
||||
Unref(expire_func);
|
||||
Unref(expire_time);
|
||||
Unref(change_func);
|
||||
}
|
||||
|
||||
void TableVal::RemoveAll()
|
||||
|
@ -1391,6 +1392,12 @@ void TableVal::SetAttrs(Attributes* a)
|
|||
expire_func = ef->AttrExpr();
|
||||
expire_func->Ref();
|
||||
}
|
||||
auto cf = attrs->FindAttr(ATTR_ON_CHANGE);
|
||||
if ( cf )
|
||||
{
|
||||
change_func = cf->AttrExpr();
|
||||
change_func->Ref();
|
||||
}
|
||||
}
|
||||
|
||||
void TableVal::CheckExpireAttr(attr_tag at)
|
||||
|
@ -1926,6 +1933,13 @@ ListVal* TableVal::RecoverIndex(const HashKey* k) const
|
|||
Val* TableVal::Delete(const Val* index)
|
||||
{
|
||||
HashKey* k = ComputeHash(index);
|
||||
if ( k && change_func )
|
||||
{
|
||||
auto el = AsTable()->Lookup(k);
|
||||
if ( el )
|
||||
{
|
||||
}
|
||||
}
|
||||
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : 0;
|
||||
Val* va = v ? (v->Value() ? v->Value() : this->Ref()) : 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue