pub struct WriteGuard<'l> { /* private fields */ }Implementations§
Source§impl<'l> WriteGuard<'l>
impl<'l> WriteGuard<'l>
pub fn push(&mut self, data: u8)
pub fn extend(&mut self, data: &[u8])
Sourcepub fn encode_timestamp(&mut self, ts: u64) -> DeltaEncodedTimestamp
pub fn encode_timestamp(&mut self, ts: u64) -> DeltaEncodedTimestamp
Converts the absolute timestamp ts of the row written with this guard into the value to
serialize (see “Timestamps” in the docs of TraceRow). Writes a
TraceRow::TimestampBase row first, when one is needed. Must be called before the row
itself is written (inside the callback of WriteGuard::mark for a marked row), and only
once per row.
Sourcepub fn mark(&mut self, marker: u64, write: impl FnOnce(&mut Self))
pub fn mark(&mut self, marker: u64, write: impl FnOnce(&mut Self))
Marks exactly what write writes with this guard as a row with marker. As long as
nothing else is written on this thread and the row wasn’t sent to the writer thread in
between, it can be removed again with WriteGuard::remove_last_row.
Sourcepub fn remove_last_row(&mut self, marker: u64) -> bool
pub fn remove_last_row(&mut self, marker: u64) -> bool
Removes the last row written on this thread, if it was marked with marker by
WriteGuard::mark and is still at the end of the thread local buffer. Returns whether
it was removed. The timestamp encoder is restored to its state before the removed row,
and a TraceRow::TimestampBase row written for it is removed as well.