Skip to main content

Crate mesh

Crate mesh 

Source
Expand description

Channel-based communication framework for OpenVMM and OpenHCL.

mesh provides typed channels (Sender<T> / Receiver<T>) that work the same way whether the two ends are in the same process or in different ones. Components that communicate through mesh channels can be moved between processes without changing their code.

This is the facade crate — it re-exports the important types from the lower-level mesh_channel, mesh_node, mesh_protobuf, and mesh_derive crates. Most code should only depend on this crate.

§Channels

  • channel() — multi-producer channel (Sender<T> / Receiver<T>).
  • oneshot() — single-use transfer (OneshotSender<T> / OneshotReceiver<T>).
  • rpc::Rpc — request/response: bundles a request with a reply channel. The conventional pattern is an enum of Rpc variants.
  • Cell / CellUpdater — publish-subscribe for configuration updates.
  • pipeAsyncRead / AsyncWrite byte stream with backpressure.
  • CancelContext — cooperative cancellation with deadlines.

§Message types

Any type can be sent over a channel within a single process. To cross process boundaries, derive MeshPayload:

use mesh::rpc::Rpc;

#[derive(MeshPayload)]
enum MyRequest {
    DoThing(Rpc<Input, Output>),
    Stop(Rpc<(), ()>),
}

MeshPayload types can include channel endpoints, file descriptors, and OS handles as fields — these are transferred automatically when the message crosses a process boundary.

See the mesh guide for a full introduction.

Modules§

error
Remotable errors.
local_node
message
Implements the Message type.
payload
pipe
Implementation a unidirectional byte stream pipe over mesh.
resource
Mesh resource definitions.
rpc
Remote Procedure Call functionality.

Structs§

Address
A port address.
Cancel
A cancel notifier.
CancelContext
A cancellation context.
Cancelled
Cell
A cell containing a value that can be updated from a remote node.
CellUpdater
A type used to update the value in one or more Cells.
ChannelError
An error representing a failure of a channel.
Deadline
A point in time that acts as a deadline for an operation.
Message
A message on a port.
NodeId
A node ID.
OneshotReceiver
The receiving half of a channel returned by oneshot.
OneshotSender
The sending half of a channel returned by oneshot.
OwnedMessage
A message on a port.
PortId
A port ID.
Receiver
The receiving half of a channel returned by channel.
Sender
The sending half of a channel returned by channel.
Uuid
A unique ID.

Enums§

CancelReason
ChannelErrorKind
The kind of channel failure.
RecvError
An error when receiving a message from a channel.
TryRecvError
An error when trying to receive a message from a channel.

Traits§

MeshPayload
Trait for types that can be constructed as a Message.

Functions§

cell
Creates a new cell and its associated updater.
channel
Creates a new channel for sending messages of type T, returning the sender and receiver ends.
mpsc_channel
Creates a new channel for sending messages of type T, returning the sender and receiver ends.
oneshot
Creates a unidirection channel for sending a single value of type T.

Derive Macros§

MeshPayload
The derive macro for MeshPayload.