Preview of the proposed up-rust native-frame-model branch (up-rust b6b99c6d, up-spec f0e9b17) — not released documentation. branch · write-up

Trait UZeroCopyTransportImpl

Source
pub trait UZeroCopyTransportImpl: Send + Sync {
    type Tx: UTxBuffer + Send;
    type Rx: UZeroCopyRxLease + Send + 'static;

    // Required methods
    fn loan_validated_tx<'life0, 'async_trait>(
        &'life0 self,
        spec: UTxLoanSpec,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Tx, UStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_validated_zero_copy<'life0, 'async_trait>(
        &'life0 self,
        buffer: Self::Tx,
    ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn receive_validated_zero_copy<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _source_filter: &'life1 UUri,
        _sink_filter: Option<&'life2 UUri>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Rx, UStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn register_validated_zero_copy_listener<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _source_filter: &'life1 UUri,
        _sink_filter: Option<&'life2 UUri>,
        _listener: Arc<dyn UZeroCopyListener<Self::Rx>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn unregister_validated_zero_copy_listener<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _source_filter: &'life1 UUri,
        _sink_filter: Option<&'life2 UUri>,
        _listener: Arc<dyn UZeroCopyListener<Self::Rx>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Role: implemented by transports whose API speaks the library’s frame types; users call UZeroCopyTransport — see the trait map.

Semantic native-frame implementation boundary for zero-copy transports.

Implementing this trait buys the validated public UZeroCopyTransport API, listener filter validation, receive-frame validation, codec extension helpers, and stable-payload initialization. This seam receives validated UFrameMetadata. A physical transport that should carry encoded metadata bytes without semantic knowledge implements UZeroCopyTransportCore instead and is wrapped by the selected-wire adapter.

Two operations are required: reserve a validated TX loan and commit it. Pull receive and listener registration/unregistration have default unsupported implementations; override only the carriage patterns the technology supports. UZeroCopyUninitTransportImpl adds the optional uninitialized-TX capability.

The transport must honor or reject the validated payload layout, keep TX loans exclusive until commit, and keep RX leases immutable until release (req~zero-copy-alignment~1, req~zero-copy-loan-isolation~1, and req~zero-copy-lease-immutability~1). InMemoryZeroCopyTransport under test-util is the semantic reference implementation.

Required Associated Types§

Source

type Tx: UTxBuffer + Send

Transport-specific transmit loan type.

Source

type Rx: UZeroCopyRxLease + Send + 'static

Transport-specific receive lease type.

Required Methods§

Source

fn loan_validated_tx<'life0, 'async_trait>( &'life0 self, spec: UTxLoanSpec, ) -> Pin<Box<dyn Future<Output = Result<Self::Tx, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reserves transmit storage for a validated frame loan spec.

Source

fn send_validated_zero_copy<'life0, 'async_trait>( &'life0 self, buffer: Self::Tx, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Commits a validated transmit loan.

Provided Methods§

Source

fn receive_validated_zero_copy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _source_filter: &'life1 UUri, _sink_filter: Option<&'life2 UUri>, ) -> Pin<Box<dyn Future<Output = Result<Self::Rx, UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Receives one matching zero-copy frame from transports that support pull receive.

Source

fn register_validated_zero_copy_listener<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _source_filter: &'life1 UUri, _sink_filter: Option<&'life2 UUri>, _listener: Arc<dyn UZeroCopyListener<Self::Rx>>, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Registers a zero-copy listener after public filter validation.

Source

fn unregister_validated_zero_copy_listener<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _source_filter: &'life1 UUri, _sink_filter: Option<&'life2 UUri>, _listener: Arc<dyn UZeroCopyListener<Self::Rx>>, ) -> Pin<Box<dyn Future<Output = Result<(), UStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Unregisters a zero-copy listener after public filter validation.

Implementors§