[−][src]Struct simple_wal::LogFile
A write-ahead-log.
Implementations
impl LogFile
[src]
pub fn first_entry<'l>(&'l mut self) -> Result<LogEntry<'l>, LogError>
[src]
The first entry in the log
pub fn seek<'l>(&'l mut self, to_index: u64) -> Result<LogEntry<'l>, LogError>
[src]
Seek to the given entry in the log
pub fn first_index(&self) -> u64
[src]
Returns the index/sequence number of the first entry in the log
pub fn last_index(&self) -> u64
[src]
Returns the index/sequence number of the last entry in the log
pub fn iter<'s, R: RangeBounds<u64>>(
&'s mut self,
range: R
) -> Result<LogIterator<'s>, LogError>
[src]
&'s mut self,
range: R
) -> Result<LogIterator<'s>, LogError>
Iterate through the log
pub fn write<R: AsMut<[u8]>>(&mut self, entry: &mut R) -> Result<()>
[src]
Write the given log entry to the end of the log
pub fn flush(&mut self) -> Result<()>
[src]
Flush writes to disk
pub fn open<P: AsRef<Path>>(path: P) -> Result<LogFile, LogError>
[src]
Open the log. Takes out an advisory lock.
This is O(n): we have to iterate to the end of the log in order to clean interrupted writes and determine the length of the log
pub fn compact(&mut self, new_start_index: u64) -> Result<(), LogError>
[src]
Compact the log, removing entries older than new_start_index
.
This is done by copying all entries >= new_start_index
to a temporary file, than overriding the
old log file once the copy is complete.
Before compacting, the log is flushed.
pub fn restart(&mut self, starting_index: u64) -> Result<(), LogError>
[src]
Clear all entries in the write-ahead-log and restart at the given index.
Auto Trait Implementations
impl RefUnwindSafe for LogFile
impl Send for LogFile
impl Sync for LogFile
impl Unpin for LogFile
impl UnwindSafe for LogFile
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,