[−][src]Struct rumqttlog::storage::segment::Segment
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,