Introduce plugable cluster backends #3642
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is draft/rfc material. I'm happy to hear feedback on terminology and if people see anything conceptually off. Initially this work was meant to result in some documentation/prototype, but it's been reasonably straight-forward, I could even see something like this going in, just so there's no large diff hanging around.
High-level
There's a new
Cluster::publish()
method that acts likeBroker::publish()
.Cluster::publish()
, however, may use an alternative cluster backend if enabled. There's also newCluster::subscribe()
andCluster::unsubscribe()
bifs.By default, these new cluster bifs use the existing broker implementation.
However, it's now possible to
redef
Cluster::backend` to another cluster backend. This PR provides one possible example that is using NATS. It's not decided that NATS will be Zeek's future cluster backend, it's just very easily to get setup with and their C library is available as package on Ubuntu 馃槄Additionally,
redef Cluster::serializer
allows to change the encoding of Zeek events. The added implementationBROKER_BIN_V1
directly leverages broker's functions for serialization/de-serialization.The commit titles should give an impression about the steps involved. A summary of the new components:
CLUSTER_SERIALIZER
cluster::detail::Zeek
instance (basically FuncValPtr/EventHandler, zeek::Args and (todo) metadata) into a byte buffercluster::detail::Zeek
instance that can then be queuedCLUSTER_BACKEND
Missing
Broker::publish()
in the base scripts unless they are broker specific (think acld or zeekctl where broker Python bindings are involved).