pub trait PipeLog: Sized {
    fn read_bytes(&self, handle: FileBlockHandle) -> Result<Vec<u8>>;
    fn append(&self, queue: LogQueue, bytes: &[u8]) -> Result<FileBlockHandle>;
    fn maybe_sync(&self, queue: LogQueue, sync: bool) -> 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.

Required Methods

Reads some bytes from the specified position.

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

Hints it to synchronize buffered writes. The synchronization is mandotory when sync is true.

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 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