Skip to content

Commit

Permalink
doc: adds documentation for the index module
Browse files Browse the repository at this point in the history
  • Loading branch information
arindas committed Jan 13, 2024
1 parent 99d7e22 commit 3cdae60
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/storage/commit_log/segmented_log/index.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides components necessary for mapping record indices to store-file positions in segments.
//!
//! This module is used by the `segment`implementation to store mapping from record
//! indices to positions on the `segment-store` file.
//! This module is used by the `segment` implementation to store mappings from record-indices to
//! positions on the `segment-store` file.
use super::{
super::super::{AsyncConsume, AsyncIndexedRead, AsyncTruncate, Sizable, Storage},
Expand All @@ -14,7 +14,7 @@ use std::{
ops::Deref,
};

/// Extension used by backing files for [`Index`] instances.
/// Extension used by backing files for [Index] instances.
pub const INDEX_FILE_EXTENSION: &str = "index";

/// Number of bytes required for storing the base marker.
Expand All @@ -26,6 +26,8 @@ pub const INDEX_RECORD_LENGTH: usize = 16;
/// Lowest underlying storage position
pub const INDEX_BASE_POSITION: u64 = 0;

/// Unit of storage on an Index. Stores position, length and checksum metadata for a single
/// [`Record`](super::Record) persisted in the `segment` [`Store`](super::store::Store).
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct IndexRecord {
pub checksum: u64,
Expand All @@ -42,6 +44,7 @@ impl From<IndexRecord> for RecordHeader {
}
}

/// Marker to persist the starting `base_index` of an [`Index`] in the index [`Storage`].
pub struct IndexBaseMarker {
pub base_index: u64,
_padding: u64,
Expand Down

0 comments on commit 3cdae60

Please sign in to comment.