Skip to main content

Module embedded

Module embedded 

Source
Available on crate feature build only.
Expand description

“Embedded” deployment backend for Hydro.

Instead of compiling each location into a standalone binary, this backend generates a Rust source file containing one function per location. Each function returns a dfir_rs::scheduled::graph::Dfir that can be manually driven by the caller.

This is useful when you want full control over where and how the projected DFIR code runs (e.g. embedding it into an existing application).

§Networking

Process and cluster networking (o2o, o2m, m2o, m2m) is supported. When a location has network sends or receives, the generated function takes additional network_out and network_in parameters whose types are generated structs with one field per network port (named after the channel). Network channels must be named via .name() on the networking config.

  • Sinks (EmbeddedNetworkOut): one FnMut(..) field per outgoing channel.
  • Sources (EmbeddedNetworkIn): one Stream field per incoming channel.

The exact field types depend on the channel’s serialization:

  • With bincode serialization, Hydro serializes to bytes, so sinks are FnMut(Bytes) and sources are Stream<Item = Result<BytesMut, io::Error>>.
  • With embedded serialization, the raw element type T flows across the channel, so sinks are FnMut(T) and sources are Stream<Item = T> (with no transport Result — the caller decides how to handle faults).

Channels keyed by a cluster member (demux / cluster send) additionally carry a TaglessMemberId alongside the payload in these types.

The caller is responsible for wiring these together (e.g. via in-memory channels, sockets, etc.). External ports are not supported.

Structs§

EmbeddedInstantiateEnv
Collected embedded input/output registrations, keyed by location.
EmbeddedNode
A trivial node type for embedded deployment. Stores a user-provided function name.

Enums§

EmbeddedDeploy
Marker type for the embedded deployment backend.