Skip to content

Commit

Permalink
*: revise comments
Browse files Browse the repository at this point in the history
Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
  • Loading branch information
Fullstop000 committed Sep 23, 2019
1 parent 26e0c2e commit 6dd6689
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ pub struct DBImpl {
// all relative methods are using immutable borrowing,
// we still need to mutate the field `mem` and `im_mem` in few situations.
mem: ShardedLock<MemTable>,
im_mem: ShardedLock<Option<MemTable>>, // iff the memtable is compacted
im_mem: ShardedLock<Option<MemTable>>, // There is a compacted immutable table or not
// Have we encountered a background error in paranoid mode
bg_error: RwLock<Option<WickErr>>,
// Whether the db is closing
Expand Down
2 changes: 1 addition & 1 deletion src/record/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub struct Reader {
// NOTICE: we probably mutate the underlying file in the FilePtr by calling `seek()` and this is not thread safe
file: Box<dyn File>,
reporter: Option<Box<dyn Reporter>>,
// iff check sum for the record
// We should check sum for the record or not
checksum: bool,
// Last Read() indicated EOF by returning < BLOCK_SIZE
eof: bool,
Expand Down
5 changes: 2 additions & 3 deletions src/record/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Writer {
pub fn add_record(&mut self, s: &Slice) -> Result<()> {
let data = s.as_slice();
let mut left = s.size();
let mut begin = true; // indicate iff the record is a First or Middle record
let mut begin = true; // indicate the record is a First or Middle record
while {
assert!(
BLOCK_SIZE >= self.block_offset,
Expand All @@ -79,8 +79,7 @@ impl Writer {
);
let space = BLOCK_SIZE - self.block_offset - HEADER_SIZE;
let to_write = if left < space { left } else { space };
// indicates iff the data exhausts a record
let end = to_write == left;
let end = to_write == left; // indicates whether the data exhausts a record
let t = {
if begin && end {
RecordType::Full
Expand Down
2 changes: 1 addition & 1 deletion src/version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ impl Version {
// beginning of range is after all files, so no overlap
return false;
}
// check iff the upper bound is overlapping
// check whether the upper bound is overlapping
!self.key_is_before_file(self.files[level][index].clone(), largest_ukey)
}

Expand Down
2 changes: 1 addition & 1 deletion src/version/version_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub struct VersionSet {
pub compaction_stats: Vec<CompactionStats>,
// Set of table files to protect from deletion because they are part of ongoing compaction
pub pending_outputs: HashSet<u64>,
// iff should schedule a manual compaction, temporarily just for test
// Represent a manual compaction, temporarily just for test
pub manual_compaction: Option<ManualCompaction>,
// WAL writer
pub record_writer: Option<Writer>,
Expand Down

0 comments on commit 6dd6689

Please sign in to comment.