pub trait PipeLog: Sized {
    fn read_bytes(&self, handle: FileBlockHandle) -> Result<Vec<u8>>;
    fn append<T: ReactiveBytes + ?Sized>(
        &self,
        queue: LogQueue,
        bytes: &mut T
    ) -> Result<FileBlockHandle>; fn sync(&self, queue: LogQueue) -> Result<()>; fn file_span(&self, queue: LogQueue) -> (FileSeq, FileSeq); fn total_size(&self, queue: LogQueue) -> usize; fn rotate(&self, queue: LogQueue) -> Result<()>; fn purge_to(&self, file_id: FileId) -> Result<usize>; fn file_at(&self, queue: LogQueue, position: f64) -> FileSeq { ... } }
Expand description

A PipeLog serves reads and writes over multiple queues of log files.

Safety

The pipe will panic if it encounters an unrecoverable failure. Otherwise the operations on it should be atomic, i.e. failed operation will not affect other ones, and user can still use it afterwards without breaking consistency.

Required Methods

Reads some bytes from the specified position.

Appends some bytes to the specified log queue. Returns file position of the written bytes.

Synchronizes all buffered writes.

This operation might incurs a great latency overhead. It’s advised to call it once every batch of writes.

Returns the smallest and largest file sequence number, still in use, of the specified log queue.

Returns total size of the specified log queue.

Rotates a new log file for the specified log queue.

Implementation should be atomic under error conditions but not necessarily panic-safe.

Deletes all log files up to the specified file ID. The scope is limited to the log queue of file_id.

Returns the number of deleted files.

Provided Methods

Returns the oldest file ID that is newer than position% of all files.

Implementors