pub struct Fs { /* private fields */ }Expand description
A commitlog repository Repo which stores commits in ordinary files on
disk.
Implementations§
Source§impl Fs
impl Fs
Sourcepub fn new(root: CommitLogDir) -> Result<Self>
pub fn new(root: CommitLogDir) -> Result<Self>
Create a commitlog repository which stores segments in the directory root.
root must name an extant, accessible, writeable directory.
Sourcepub fn segment_path(&self, offset: u64) -> SegmentFile
pub fn segment_path(&self, offset: u64) -> SegmentFile
Get the filename for a segment starting with offset within this
repository.
Sourcepub fn size_on_disk(&self) -> Result<u64>
pub fn size_on_disk(&self) -> Result<u64>
Determine the size on disk as the sum of the sizes of all segments.
Note that the actively written-to segment (if any) is included.
Trait Implementations§
Source§impl Repo for Fs
impl Repo for Fs
Source§type SegmentWriter = File
type SegmentWriter = File
The type of log segments managed by this repo, which must behave like a file.
type SegmentReader = CompressReader
Source§fn create_segment(&self, offset: u64) -> Result<Self::SegmentWriter>
fn create_segment(&self, offset: u64) -> Result<Self::SegmentWriter>
Create a new segment with the minimum transaction offset
offset. Read moreSource§fn open_segment_writer(&self, offset: u64) -> Result<Self::SegmentWriter>
fn open_segment_writer(&self, offset: u64) -> Result<Self::SegmentWriter>
Open an existing segment at the minimum transaction offset
offset. Read moreSource§fn open_segment_reader(&self, offset: u64) -> Result<Self::SegmentReader>
fn open_segment_reader(&self, offset: u64) -> Result<Self::SegmentReader>
Open an existing segment at the minimum transaction offset
offset. Read moreSource§fn remove_segment(&self, offset: u64) -> Result<()>
fn remove_segment(&self, offset: u64) -> Result<()>
Remove the segment at the minimum transaction offset
offset. Read moreSource§fn compress_segment(&self, offset: u64) -> Result<()>
fn compress_segment(&self, offset: u64) -> Result<()>
Compress a segment in storage, marking it as immutable.
Source§fn existing_offsets(&self) -> Result<Vec<u64>>
fn existing_offsets(&self) -> Result<Vec<u64>>
Traverse all segments in this repository and return list of their
offsets, sorted in ascending order.
Source§fn create_offset_index(
&self,
offset: TxOffset,
cap: u64,
) -> Result<TxOffsetIndexMut>
fn create_offset_index( &self, offset: TxOffset, cap: u64, ) -> Result<TxOffsetIndexMut>
Create
TxOffsetIndexMut for the given offset or open it if already exist.
The cap parameter is the maximum number of entries in the index.Source§fn remove_offset_index(&self, offset: TxOffset) -> Result<()>
fn remove_offset_index(&self, offset: TxOffset) -> Result<()>
Remove
TxOffsetIndexMut named with offset.Source§fn get_offset_index(&self, offset: TxOffset) -> Result<TxOffsetIndex>
fn get_offset_index(&self, offset: TxOffset) -> Result<TxOffsetIndex>
Get
TxOffsetIndex for the given offset.Auto Trait Implementations§
impl Freeze for Fs
impl RefUnwindSafe for Fs
impl Send for Fs
impl Sync for Fs
impl Unpin for Fs
impl UnwindSafe for Fs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more