Skip to main content

Crate proxima_primitives

Crate proxima_primitives 

Source
Expand description

The pipe algebra and the runtime-agnostic primitives beneath it.

One trait, pipe::Pipe, carries typed In -> Out with an associated Err; picking In or Out as () gives the four forms (transform, source, sink, observe). Everything else here composes over it or sits under it.

  • pipe – pipe::Pipe and its additive Send form pipe::SendPipe, the PipeExt combinator sugar (.and_then/.filter/.fanout/.fanin), Request/Response envelopes over Bytes, HeaderList, the streaming bodies (ResponseStream/RequestStream over ChunkStream) and the in-process Carry payload, Handler (Request<Bytes> -> Response<Bytes>), SourcePipe, and the resilience, rate-limit, retry, routing and telemetry/capture surfaces. Plugin authors’ primary surface.
  • sync – runtime-agnostic concurrency primitives shaped like tokio::sync (Mutex, Notify, mpsc, oneshot, watch, broadcast, plus blocking, task, shutdown), so no pipe needs tokio to coordinate.
  • stream – byte-stream and datagram traits (StreamConnection, StreamListener, StreamUpstream, DatagramSocket) built on futures::io, shared by every wire-protocol stack above them.
  • transport – Replay (record-and-replay of a stream with fan-out sinks), the tap_complete taps and the GenericStream seam; sits below pipe.
  • driver – block_on, the no-runtime way to drive one future to completion.
  • codec, block_layout, float_layout – data descriptions of packed numeric storage: Codec names a packed byte layout, BlockLayout describes a block of stored numbers, FloatLayout one stored float.

The crate is no_std unless the default std feature is on. pipe splits further: the pipe forms compile with no allocator, most of the envelope and combinator surface needs alloc, and registries and lifecycle helpers need std. Each item’s own doc names its tier.

Re-exports§

pub use codec::Codec;
pub use driver::block_on;
pub use pipe::PipeExt;

Modules§

block_layout
A block layout describes how a run of stored numbers is packed: how many elements share one scale (and optional min), where each bit plane of an element’s code lives, how sub-blocks of the block carry their own scale and min, and how a code becomes a value, (multiplier * code - bias) * scale * sub_scale + min_multiplier * (min * sub_min).
codec
The one source-neutral codec identity: which packed byte layout a quantized/packed buffer holds. Payload-less by design – a pipe or fn pointer cannot serialize itself to a wire byte, so a sidecar wire format (proxima-model-interop’s expert sidecar today) needs a compile-time- exhaustive, serializable tag instead. Codec::tag/Codec::from_tag are that wire mapping.
driver
the no-runtime drive primitive: block_on.
float_layout
A float layout is a tuple of exponent width, mantissa width and special-value policy; the scalar codecs proxima-gguf/src/quant/bf8_e5m2.rs and bf4_e2m1.rs will instantiate it instead of each hand-coding the same arithmetic.
pipe
Plugin surface for proxima.
stream
Bidirectional byte-stream primitive. Trait bound is futures::io (not tokio::io) so non-tokio backends — AF_XDP, DPDK, glommio, smol — can implement without a tokio dep. Tokio backends use the tokio-util::compat shim at the impl boundary.
sync
proxima::sync — runtime-agnostic concurrency primitives shaped like tokio::sync. Users get the API surface they expect (use proxima_primitives::sync::Mutex;) without pulling tokio. Backing crates are futures (channels, lock::Mutex), async-lock (RwLock, Semaphore), event-listener (Notify), and async-broadcast (watch, broadcast).
transport
Transport stream primitives: Replay, the tap_complete taps, and the GenericStream seam.