pub struct ComputeFace { /* private fields */ }Expand description
A synthetic face that routes Interests to registered compute handlers.
The FIB routes Interests matching /compute/* (or any registered prefix)
to this face. On receipt via Face::send, ComputeFace dispatches to
the appropriate ComputeHandler, encodes the
resulting Data, and makes it available through Face::recv so the
engine pipeline can satisfy the originating PIT entries.
§Wiring
Register the face with the engine, then add a FIB route pointing the
desired prefix at this face’s FaceId. The engine will forward matching
Interests here automatically and pick up computed Data through recv().
Implementations§
Source§impl ComputeFace
impl ComputeFace
Sourcepub fn new(id: FaceId, registry: Arc<ComputeRegistry>) -> Self
pub fn new(id: FaceId, registry: Arc<ComputeRegistry>) -> Self
Create a new ComputeFace with an internal channel depth of capacity
pending computed responses.
Sourcepub fn with_capacity(
id: FaceId,
registry: Arc<ComputeRegistry>,
capacity: usize,
) -> Self
pub fn with_capacity( id: FaceId, registry: Arc<ComputeRegistry>, capacity: usize, ) -> Self
Create with an explicit response channel capacity.
Trait Implementations§
Source§impl Face for ComputeFace
impl Face for ComputeFace
Source§async fn recv(&self) -> Result<Bytes, FaceError>
async fn recv(&self) -> Result<Bytes, FaceError>
Receive the next computed Data packet.
Blocks until a send() call completes computation and enqueues a
response, or returns FaceError::Closed if all senders are dropped.
Source§async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
Dispatch an incoming Interest to the matching compute handler.
Decodes the Interest, looks up the handler in the registry via
longest-prefix match, and spawns a task to run the handler and inject
the resulting Data wire bytes back through recv().
Returns immediately — computation is async and non-blocking.
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
Source§fn remote_uri(&self) -> Option<String>
fn remote_uri(&self) -> Option<String>
udp4://192.168.1.1:6363). Returns None for face
types that don’t have a meaningful remote endpoint.Source§fn local_uri(&self) -> Option<String>
fn local_uri(&self) -> Option<String>
unix:///run/nfd/nfd.sock). Returns None for face
types that don’t expose local binding info.