mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Merge topic/actor-system throug a squashed commit.
This commit is contained in:
parent
7a6f5020f6
commit
fe7e1ee7f0
466 changed files with 12559 additions and 9655 deletions
|
@ -119,14 +119,8 @@ bool WriterBackend::WriterInfo::Write(SerializationFormat* fmt) const
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_BROKER
|
||||
broker::data WriterBackend::WriterInfo::ToBroker() const
|
||||
{
|
||||
auto bpath = broker::record::field(path);
|
||||
auto brotation_base = broker::record::field(rotation_base);
|
||||
auto brotation_interval = broker::record::field(rotation_interval);
|
||||
auto bnetwork_time = broker::record::field(network_time);
|
||||
|
||||
auto t = broker::table();
|
||||
|
||||
for ( config_map::const_iterator i = config.begin(); i != config.end(); ++i )
|
||||
|
@ -136,23 +130,20 @@ broker::data WriterBackend::WriterInfo::ToBroker() const
|
|||
t.insert(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
auto bconfig = broker::record::field(move(t));
|
||||
|
||||
return move(broker::record({bpath, brotation_base, brotation_interval, bnetwork_time, bconfig}));
|
||||
return broker::vector({path, rotation_base, rotation_interval, network_time, std::move(t)});
|
||||
}
|
||||
|
||||
bool WriterBackend::WriterInfo::FromBroker(broker::data d)
|
||||
{
|
||||
auto r = broker::get<broker::record>(d);
|
||||
|
||||
if ( ! r )
|
||||
if ( ! broker::is<broker::vector>(d) )
|
||||
return false;
|
||||
|
||||
auto bpath = broker::get<std::string>(*r->get(0));
|
||||
auto brotation_base = broker::get<double>(*r->get(1));
|
||||
auto brotation_interval = broker::get<double>(*r->get(2));
|
||||
auto bnetwork_time = broker::get<double>(*r->get(3));
|
||||
auto bconfig = broker::get<broker::table>(*r->get(4));
|
||||
auto v = broker::get<broker::vector>(d);
|
||||
auto bpath = broker::get_if<std::string>(v[0]);
|
||||
auto brotation_base = broker::get_if<double>(v[1]);
|
||||
auto brotation_interval = broker::get_if<double>(v[2]);
|
||||
auto bnetwork_time = broker::get_if<double>(v[3]);
|
||||
auto bconfig = broker::get_if<broker::table>(v[4]);
|
||||
|
||||
if ( ! (bpath && brotation_base && brotation_interval && bnetwork_time && bconfig) )
|
||||
return false;
|
||||
|
@ -164,8 +155,8 @@ bool WriterBackend::WriterInfo::FromBroker(broker::data d)
|
|||
|
||||
for ( auto i : *bconfig )
|
||||
{
|
||||
auto k = broker::get<std::string>(i.first);
|
||||
auto v = broker::get<std::string>(i.second);
|
||||
auto k = broker::get_if<std::string>(i.first);
|
||||
auto v = broker::get_if<std::string>(i.second);
|
||||
|
||||
if ( ! (k && v) )
|
||||
return false;
|
||||
|
@ -176,7 +167,6 @@ bool WriterBackend::WriterInfo::FromBroker(broker::data d)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
WriterBackend::WriterBackend(WriterFrontend* arg_frontend) : MsgThread()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue