pub struct SpscFace { /* private fields */ }Expand description
Engine-side SPSC SHM face.
Create with SpscFace::create; register with the engine via
ForwarderEngine::add_face. Give the name to the application so it can
call SpscHandle::connect.
Implementations§
Source§impl SpscFace
impl SpscFace
Sourcepub fn create(id: FaceId, name: &str) -> Result<Self, ShmError>
pub fn create(id: FaceId, name: &str) -> Result<Self, ShmError>
Create the SHM region and set up the wakeup mechanism.
name identifies this face (e.g. "sensor-0"); pass it to
SpscHandle::connect in the application process.
Sourcepub fn create_for_mtu(
id: FaceId,
name: &str,
mtu: usize,
) -> Result<Self, ShmError>
pub fn create_for_mtu( id: FaceId, name: &str, mtu: usize, ) -> Result<Self, ShmError>
Create a face sized for Data packets whose content can be up
to mtu bytes. Picks slot_size = slot_size_for_mtu(mtu) and
scales capacity inversely so the total ring memory stays
within [SHM_BUDGET]. Use this when an application has
announced its expected packet size via faces/create’s mtu
ControlParameter.
Sourcepub fn create_with(
id: FaceId,
name: &str,
capacity: u32,
slot_size: u32,
) -> Result<Self, ShmError>
pub fn create_with( id: FaceId, name: &str, capacity: u32, slot_size: u32, ) -> Result<Self, ShmError>
Create with explicit ring parameters.
Sourcepub async fn send_batch(&self, pkts: &[Bytes]) -> Result<(), FaceError>
pub async fn send_batch(&self, pkts: &[Bytes]) -> Result<(), FaceError>
Send multiple Data/Interest packets to the app in a single tail
advance. See SpscHandle::send_batch for the semantics — this
is the engine-side mirror.
Trait Implementations§
Source§impl Face for SpscFace
impl Face for SpscFace
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
Source§async fn recv(&self) -> Result<Bytes, FaceError>
async fn recv(&self) -> Result<Bytes, FaceError>
Source§async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
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.