liftof_rb::api

Function experimental_ram_buffer_handler

Source
pub fn experimental_ram_buffer_handler(
    buff_trip: usize,
    streamer: &mut RBEventMemoryStreamer,
) -> Result<(RamBuffer, usize), RegisterError>
Expand description

Manage the RAM buffers for event data

This experimental version of the ram buffer handler will directly push the content of the ram buffer into an RBEventMemoryStreamer.

EXPERIMENTAL - there is some unsafe stuff going on, which I am not sure about.

Rationale - this avoids at least 2 clones and possibly an entire thread. So it might boost performance.

Difference to previous approach:

Instead of sending the resulting vector of bytes away, we fed the streamer. Then in a second step, either the streamer has to digest its data, or we need to send the streamer somewhere.

ยงArguments:

  • buff_trip : size which triggers buffer readout.
  • streamer : RBEventMemoryStreamer which will consume the ram buffer