Skip to content

Commit

Permalink
chore: adds documentation for SegmentedLogError
Browse files Browse the repository at this point in the history
  • Loading branch information
arindas committed Feb 27, 2024
1 parent b70ba84 commit f95fb55
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/storage/commit_log/segmented_log/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ use std::{
time::Duration,
};

/// Represent metadata for records in the [`SegmentedLog`].
/// Represents metadata for records in the [`SegmentedLog`].
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub struct MetaWithIdx<M, Idx> {
/// Generic metadata for the record as necessary
Expand Down Expand Up @@ -162,15 +162,33 @@ where
/// parameter.
pub type Record<M, Idx, T> = super::Record<MetaWithIdx<M, Idx>, T>;

/// Error type associated with [`SegmentedLog`] operations.
#[derive(Debug)]
pub enum SegmentedLogError<SE, SDE, CE> {
/// Used to denote errors from the underlying [`Storage`] implementation.
StorageError(SE),

/// Used to denote errors from operations on [`Segment`] instances.
SegmentError(segment::SegmentError<SE, SDE>),

/// Used to denote errors from the [`SegmentedLog`] inner cache.
CacheError(CE),

/// Used when the inner cache is not configured while using APIs that expect it.
CacheNotFound,

/// Used when the resulting `base_index` of a [`Segment`] in the [`SegmentedLog`]
/// is lesser than the `initial_index` configured at the [`SegmentedLog`] level.
BaseIndexLesserThanInitialIndex,

/// Used when the _write_ [`Segment`] containing [`Option`] is set to `None`
WriteSegmentLost,

/// Used when the given index is outside the range `[lowest_index, highest_index)`
IndexOutOfBounds,

/// Used when no [`Record`] is found at a valid index inside the range
/// `[lowest_index, highest_index]`
IndexGapEncountered,
}

Expand Down
2 changes: 1 addition & 1 deletion src/storage/commit_log/segmented_log/store.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Present the backing storge components for a `segment` in a `segmented-log`.
//! Present the backing storage components for a `segment` in a `segmented-log`.
//!
//! This module is responsible for ultimately persisting the records in our `segmented-log` to some
//! form of [`Storage`].
Expand Down

0 comments on commit f95fb55

Please sign in to comment.