mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
broker integration: adapt to change in expiration_time
This commit is contained in:
parent
ec39eee786
commit
0253f49a94
2 changed files with 14 additions and 8 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 0760c6808c1d035b7e9f484daefe8ba0a3d6ee13
|
||||
Subproject commit b0d97b1fcbdcb9027bd34031c8706be0c0ab315b
|
|
@ -108,20 +108,26 @@ function Store::insert%(h: opaque of Store::Handle,
|
|||
auto& key = comm::opaque_field_to_data(k->AsRecordVal(), frame);
|
||||
auto& val = comm::opaque_field_to_data(v->AsRecordVal(), frame);
|
||||
|
||||
broker::util::optional<broker::store::expiration_time> expiry;
|
||||
using broker::store::expiration_time;
|
||||
broker::util::optional<expiration_time> expiry;
|
||||
|
||||
auto abs_expiry_val = e->AsRecordVal()->Lookup(0);
|
||||
auto rel_expiry_val = e->AsRecordVal()->Lookup(1);
|
||||
|
||||
if ( abs_expiry_val )
|
||||
{
|
||||
auto tag = broker::store::expiration_time::tag::absolute;
|
||||
expiry = broker::store::expiration_time(abs_expiry_val->AsTime(), tag);
|
||||
expiry = expiration_time(abs_expiry_val->AsTime());
|
||||
handle->store->insert(key, val, expiry);
|
||||
return new Val(true, TYPE_BOOL);
|
||||
}
|
||||
else if ( rel_expiry_val )
|
||||
|
||||
auto rel_expiry_val = e->AsRecordVal()->Lookup(1);
|
||||
|
||||
if ( rel_expiry_val )
|
||||
{
|
||||
auto tag = broker::store::expiration_time::tag::since_last_modification;
|
||||
expiry = broker::store::expiration_time(rel_expiry_val->AsInterval(), tag);
|
||||
auto ct = broker::time_point::now().value;
|
||||
expiry = expiration_time(rel_expiry_val->AsInterval(), ct);
|
||||
handle->store->insert(key, val, expiry);
|
||||
return new Val(true, TYPE_BOOL);
|
||||
}
|
||||
|
||||
handle->store->insert(key, val, expiry);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue