Skip to main content

Module pipe

Module pipe 

Source
Expand description

In-process pipes to another native app (core.pipe.*, ADR-300). In-process pipes to another native app (core.pipe.*, ADR-300).

Two native apps in one host process can share a live two-way byte stream: the opener gets one end of a host-made AF_UNIX socket pair and a token for the other; it passes the token on in a capability call of its own; the receiver claims it. Each side then owns a plain Unix stream socket and wraps it on its own runtime (tokio::net::UnixStream::from_std after set_nonblocking(true)). A token nobody claims within its TTL closes, and the opener reads EOF.

ⓘ
// opener
let (ours, token) = node_app_sdk_rust::pipe::open("ln-bolt8", None)?;
invoke_capability(/* the other app's capability, carrying `token` */)?;
// receiver, inside that capability
let (theirs, _info) = node_app_sdk_rust::pipe::claim(&token)?;

Structs§

ClaimInfo
What the claimer learns about the pipe.

Constants§

CLAIM
Claims a parked end.
OPEN
Opens a pair.

Functions§

claim
Claims the end parked under token.
open
Opens a pair for purpose (1..=64 printable ASCII): this app’s end, and the token of the other end to pass on. ttl_ms bounds the wait for a claimer (host default 10 s, max 30 s).