Struct sozu_lib::buffer_queue::BufferQueue[][src]

pub struct BufferQueue {
    pub buffer_position: usize,
    pub parsed_position: usize,
    pub start_parsing_position: usize,
    pub buffer: Checkout,
    pub input_queue: Vec<InputElement>,
    pub output_queue: Vec<OutputElement>,
}

The BufferQueue has two roles: holding incoming data, and indicating which data will go out. When new data arrives, it is added at the end of the internal buffer. This new data is then eventually parsed or handled in some way by external code. The external code then adds element to the queue, indicating what to do with the data:

  • copy a subset of the input data (and advance if needed)
  • insert external data, like a HTTP header
  • splice out of the kernel some data that was spliced in

position is the index in the stream of data already handled. it corresponds to the beginning of available data in the Buffer a Slice(begin, end) would point to buffer.data()[begin-position..end-position] (in the easiest case)

unparsed_position is the index in the stream of data that was not parsed yet

The buffer’s available data may be smaller than end - begin. It can happen if the parser indicated we need to copy more data than is available, like with a content length

should the buffer queue indicate how much data it needs?

Fields

buffer_position: usize

position of buffer start in stream

parsed_position: usizestart_parsing_position: usizebuffer: Checkoutinput_queue: Vec<InputElement>

Vec<(start, length)>

output_queue: Vec<OutputElement>

Implementations

impl BufferQueue[src]

pub fn with_buffer(buffer: Checkout) -> BufferQueue

Notable traits for BufferQueue

impl Write for BufferQueue
[src]

pub fn invariant(&self)[src]

pub fn available_input_data(&self) -> usize[src]

pub fn sliced_input(&mut self, count: usize)[src]

pub fn spliced_input(&mut self, count: usize)[src]

pub fn needs_input(&self) -> bool[src]

pub fn can_restart_parsing(&self) -> bool[src]

pub fn empty(&self) -> bool[src]

pub fn merge_input_slices(&self) -> usize[src]

pub fn input_data_size(&self) -> usize[src]

pub fn unparsed_data(&self) -> &[u8][src]

pub fn consume_parsed_data(&mut self, size: usize)[src]

should only be called with a count inferior to self.input_data_size()

pub fn slice_output(&mut self, count: usize)[src]

pub fn delete_output(&mut self, count: usize)[src]

pub fn splice_output(&mut self, count: usize)[src]

pub fn insert_output(&mut self, v: Vec<u8>)[src]

pub fn has_output_data(&self) -> bool[src]

pub fn output_data_size(&self) -> usize[src]

pub fn merge_output_slices(&self) -> usize[src]

pub fn merge_output_deletes(&self) -> usize[src]

pub fn next_output_data(&self) -> &[u8][src]

pub fn as_iovec(&self) -> Vec<&IoVec>[src]

pub fn consume_output_data(&mut self, size: usize)[src]

should only be called with a count inferior to self.input_data_size()

pub fn print_unparsed(&self)[src]

pub fn print_and_consume_output(&mut self)[src]

Trait Implementations

impl Debug for BufferQueue[src]

impl Reset for BufferQueue[src]

impl Write for BufferQueue[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<W> WriteBytesExt for W where
    W: Write + ?Sized