Commit graph

17 commits

Author SHA1 Message Date
Arne Welzel
01fe022e07 cluster/serializer/broker: Do not send empty metadata vectors around
Event when there's no metadata attached to an event, we'd still use the
constructor passing an empty metadata vector, resulting in an on-the-wire
representation with an empty trailing vector.

Particularly visible when just snooping events via websocat. There also
seems to be some bug with the timestamp -1 handling.
2025-08-20 19:55:38 +02:00
Tim Wojtulewicz
18b3303b54 Add a missing header for the broker cluster serializer 2025-08-18 14:00:24 -07:00
Arne Welzel
8d0a942101 cluster/serializer/broker: Drop unused include 2025-08-18 14:52:21 +02:00
Arne Welzel
f4e7c4afe8 cluster/serializer/broker: fixup inconsistent param comment
Thanks clang-tidy.

References #4754 #4756
2025-08-18 14:51:40 +02:00
Arne Welzel
f57a1263d4 cluster/serializer/broker: Do not special case Broker::Data anymore
The previous approach ignored the fact that nested / inner values might
also be Broker::Data values. I'm not super sure about the validity of
the test, because it's essentially demonstrating any-nesting, but
it's not leading to extra Broker::Data encoding.
2025-08-17 16:56:20 +02:00
Arne Welzel
40389603c2 cluster::Event: Move implementation into cluster/Event.{h,cc} 2025-07-29 18:13:59 +02:00
Arne Welzel
bda70067ec cluster: Move cluster::detail::Event to cluster::Event
This class is a parameter of virtual methods of the Backend API for users
to implement and also a parameter to the HookPublishEvent() API. Seems it
shouldn't be in detail and instead we should own it.

Alternatively, could mark the cluster APIs as not-stable-yet, but I
think we can move forward and make it non-detail for 8.0.
2025-07-29 18:13:59 +02:00
Tim Wojtulewicz
a3078f3132 Fix clang-tidy modernize-use-emplace findings 2025-06-06 11:43:06 -07:00
Arne Welzel
46d4b5825b cluster/serializer/broker: Support generic metadata
Instead of handling just the network timestamp, support extraction of
the whole metadata vector that broker events hold.
2025-06-02 17:31:36 +02:00
Tim Wojtulewicz
1169fcf2a2 Move byte_buffer types from cluster and storage into util 2025-04-14 10:11:13 -07:00
Arne Welzel
214629e054 cluster/Event: Hide members behind accessors 2025-04-11 09:58:07 +02:00
Arne Welzel
273a6ec1f3 serializer/broker: Expose to_broker_event() and to_zeek_event()
This is useful for reuse by WebSocket clients that use
the JSON v1 encoding.
2025-03-10 17:06:16 +01:00
Arne Welzel
337b62960b cluster/broker/Serializer: Fix adaptor to adapter 2025-02-05 10:39:56 +01:00
Arne Welzel
6d1259423e cluster/serializer/broker: Fix handler lookup
Handler overwrites operator bool, so need to explicitly test for nullptr
rather than not having any handlers defined.
2025-02-05 10:39:56 +01:00
Arne Welzel
d9a74cf32d cluster: Fix Cluster::publish() of Broker::Data
The broker serializer leverages the existing data_to_val() function.
During unserialization, if the destination type is any, the logic
simply wraps the broker::data value into a Broker::Data record.
Therefore, events with any parameters are currently exposed to
the Broker::Data type.

There is a bigger issue in that re-publishing such Broker::Data
instances would encode them as a normal record. Explicitly prevent
this by serializing the contained data value directly instead, similar
to what Broker already did when publishing a record.
2024-12-12 17:54:37 +01:00
Arne Welzel
9619cd0f17 Add missing copyright line to headers and cc files 2024-12-06 12:50:58 +01:00
Arne Welzel
9ec872d161 cluster/serializer: Add Broker based event serializers
This adds the first event serializers that use
broker functionality. Binary and JSON formats.
2024-11-26 12:58:23 +01:00