[][src]Struct rumqttlog::storage::segment::Segment

pub struct Segment { /* fields omitted */ }

Segment of a storage. Writes go through a buffer writers to reduce number of system calls. Reads are directly read from the file as seek on buffer reader will dump the buffer anyway Also multiple readers might be operating on a given segment which makes the cursor movement very dynamic

Implementations

impl Segment[src]

pub fn new<P: AsRef<Path>>(dir: P, base_offset: u64) -> Result<Segment>[src]

pub fn size(&self) -> u64[src]

pub fn set_next_offset(&mut self, next_offset: u64)[src]

pub fn append(&mut self, record: &[u8]) -> Result<(u64, u64)>[src]

Appends record to the file and return its offset

pub fn read(&mut self, position: u64, buf: &mut [u8]) -> Result<u64>[src]

Reads to fill the complete buffer. Returns number of bytes read

pub fn close(&mut self) -> Result<()>[src]

Auto Trait Implementations

impl RefUnwindSafe for Segment

impl Send for Segment

impl Sync for Segment

impl Unpin for Segment

impl UnwindSafe for Segment

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> From<T> for T[src]

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

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.