Skip to main content

Module sample

Module sample 

Source
Expand description

OutputSample — a write buffer that is a ring slot when it can be.

Blueprint §9.1 promises allocate(len) → SampleMut, and §6.2 says what that means: “node.allocate(len) hands the producer a SampleMut pointing into the next FREE slot; send flips WRITING→READY. No copy ever happens for the fast path.”

This type is that buffer, plus the one thing a bare SampleMut cannot do: fall back. A node writes the same code whether or not its route has been upgraded yet, because RawOutput::allocate hands back the same type either way — SampleBuffer::Shm when the ring is available and SampleBuffer::Heap when it is not.

§Committing is consuming

OutputSample::send takes self, so a window cannot be published twice and cannot be written to after publication. Dropping one without sending aborts it, which returns the slot to the pool without consuming its sequence number — an aborted write leaves no gap for consumers to wait on.

Structs§

OutputSample
A reserved write buffer for one message.

Enums§

SampleBuffer
Where an OutputSample’s bytes live.