mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Update to latest Broker without public CAF dep
This commit is contained in:
parent
e93fcd3c64
commit
56f30b500a
32 changed files with 328 additions and 1064 deletions
|
@ -512,12 +512,12 @@ broker::expected<broker::data> BitVector::Serialize() const
|
|||
|
||||
std::unique_ptr<BitVector> BitVector::Unserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
if ( ! (v && v->size() >= 2) )
|
||||
return nullptr;
|
||||
|
||||
auto num_bits = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto size = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto num_bits = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
auto size = broker::get_if<uint64_t>(&(*v)[1]);
|
||||
|
||||
if ( ! (num_bits && size) )
|
||||
return nullptr;
|
||||
|
@ -530,7 +530,7 @@ std::unique_ptr<BitVector> BitVector::Unserialize(const broker::data& data)
|
|||
|
||||
for ( size_t i = 0; i < *size; ++i )
|
||||
{
|
||||
auto x = caf::get_if<uint64_t>(&(*v)[2 + i]);
|
||||
auto x = broker::get_if<uint64_t>(&(*v)[2 + i]);
|
||||
if ( ! x )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -46,12 +46,12 @@ broker::expected<broker::data> BloomFilter::Serialize() const
|
|||
|
||||
std::unique_ptr<BloomFilter> BloomFilter::Unserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
|
||||
if ( ! (v && v->size() == 3) )
|
||||
return nullptr;
|
||||
|
||||
auto type = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto type = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
if ( ! type )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -212,13 +212,13 @@ broker::expected<broker::data> CardinalityCounter::Serialize() const
|
|||
|
||||
std::unique_ptr<CardinalityCounter> CardinalityCounter::Unserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
if ( ! (v && v->size() >= 3) )
|
||||
return nullptr;
|
||||
|
||||
auto m = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto V = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto alpha_m = caf::get_if<double>(&(*v)[2]);
|
||||
auto m = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
auto V = broker::get_if<uint64_t>(&(*v)[1]);
|
||||
auto alpha_m = broker::get_if<double>(&(*v)[2]);
|
||||
|
||||
if ( ! (m && V && alpha_m) )
|
||||
return nullptr;
|
||||
|
@ -233,7 +233,7 @@ std::unique_ptr<CardinalityCounter> CardinalityCounter::Unserialize(const broker
|
|||
|
||||
for ( size_t i = 0; i < *m; ++i )
|
||||
{
|
||||
auto x = caf::get_if<uint64_t>(&(*v)[3 + i]);
|
||||
auto x = broker::get_if<uint64_t>(&(*v)[3 + i]);
|
||||
if ( ! x )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -169,11 +169,11 @@ broker::expected<broker::data> CounterVector::Serialize() const
|
|||
|
||||
std::unique_ptr<CounterVector> CounterVector::Unserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
if ( ! (v && v->size() >= 2) )
|
||||
return nullptr;
|
||||
|
||||
auto width = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto width = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
auto bits = BitVector::Unserialize((*v)[1]);
|
||||
|
||||
if ( ! (width && bits) )
|
||||
|
|
|
@ -60,15 +60,15 @@ broker::expected<broker::data> Hasher::Serialize() const
|
|||
|
||||
std::unique_ptr<Hasher> Hasher::Unserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
|
||||
if ( ! (v && v->size() == 4) )
|
||||
return nullptr;
|
||||
|
||||
auto type = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto k = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto h1 = caf::get_if<uint64_t>(&(*v)[2]);
|
||||
auto h2 = caf::get_if<uint64_t>(&(*v)[3]);
|
||||
auto type = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
auto k = broker::get_if<uint64_t>(&(*v)[1]);
|
||||
auto h1 = broker::get_if<uint64_t>(&(*v)[2]);
|
||||
auto h2 = broker::get_if<uint64_t>(&(*v)[3]);
|
||||
|
||||
if ( ! (type && k && h1 && h2) )
|
||||
return nullptr;
|
||||
|
|
|
@ -447,14 +447,14 @@ broker::expected<broker::data> TopkVal::DoSerialize() const
|
|||
|
||||
bool TopkVal::DoUnserialize(const broker::data& data)
|
||||
{
|
||||
auto v = caf::get_if<broker::vector>(&data);
|
||||
auto v = broker::get_if<broker::vector>(&data);
|
||||
|
||||
if ( ! (v && v->size() >= 4) )
|
||||
return false;
|
||||
|
||||
auto size_ = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto numElements_ = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto pruned_ = caf::get_if<bool>(&(*v)[2]);
|
||||
auto size_ = broker::get_if<uint64_t>(&(*v)[0]);
|
||||
auto numElements_ = broker::get_if<uint64_t>(&(*v)[1]);
|
||||
auto pruned_ = broker::get_if<bool>(&(*v)[2]);
|
||||
|
||||
if ( ! (size_ && numElements_ && pruned_) )
|
||||
return false;
|
||||
|
@ -463,7 +463,7 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
numElements = *numElements_;
|
||||
pruned = *pruned_;
|
||||
|
||||
auto no_type = caf::get_if<broker::none>(&(*v)[3]);
|
||||
auto no_type = broker::get_if<broker::none>(&(*v)[3]);
|
||||
if ( ! no_type )
|
||||
{
|
||||
auto t = UnserializeType((*v)[3]);
|
||||
|
@ -479,8 +479,8 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
while ( i < numElements )
|
||||
{
|
||||
auto elements_count = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto count = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto elements_count = broker::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto count = broker::get_if<uint64_t>(&(*v)[idx++]);
|
||||
|
||||
if ( ! (elements_count && count) )
|
||||
return false;
|
||||
|
@ -491,7 +491,7 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
for ( uint64_t j = 0; j < *elements_count; j++ )
|
||||
{
|
||||
auto epsilon = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto epsilon = broker::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto val = Broker::detail::data_to_val((*v)[idx++], type.get());
|
||||
|
||||
if ( ! (epsilon && val) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue