Skip to content

Commit 4ee66c5

Browse files
committed
better comments
1 parent b9a05ef commit 4ee66c5

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

lib/segment/src/id_tracker/mutable_id_tracker.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ fn store_mapping_changes(
401401
mappings_path: &Path,
402402
changes: &Vec<MappingChange>,
403403
) -> OperationResult<()> {
404-
// Estimate required buffer size
404+
// Estimate required buffer size.
405405
let mut counting_write = CountingWrite::default();
406406
write_mapping_changes(&mut counting_write, changes).map_err(|err| {
407407
OperationError::service_error(format!(
@@ -410,7 +410,7 @@ fn store_mapping_changes(
410410
))
411411
})?;
412412

413-
// Create a buffer with exact required size
413+
// Create a buffer with exact required size.
414414
let mut writer: Vec<u8> = Vec::default();
415415
writer
416416
.try_set_capacity_exact(counting_write.bytes_written() as usize)
@@ -421,21 +421,21 @@ fn store_mapping_changes(
421421
))
422422
})?;
423423

424-
// Collect all changes into a single buffer
424+
// Collect all changes into a single buffer.
425425
write_mapping_changes(&mut writer, changes).map_err(|err| {
426426
OperationError::service_error(format!(
427427
"Failed to collect ID tracker point mappings ({}): {err}",
428428
mappings_path.display(),
429429
))
430430
})?;
431431

432-
// Create or open file in append mode to write new changes to the end
432+
// Create or open file in append mode to write new changes to the end.
433433
let file = File::options()
434434
.create(true)
435435
.append(true)
436436
.open(mappings_path)?;
437437

438-
// Write all changes in one shot
438+
// Write all changes in one shot.
439439
let mut file_writer = BufWriter::new(file);
440440
file_writer.write_all(&writer).map_err(|err| {
441441
OperationError::service_error(format!(
@@ -444,11 +444,11 @@ fn store_mapping_changes(
444444
))
445445
})?;
446446

447-
// Drop the buffer to free memory
447+
// Drop the buffer to free memory.
448448
drop(writer);
449449

450-
// Explicitly fsync file contents to ensure durability
451-
// `BufWriter::into_inner` flushes the buffer as well
450+
// Explicitly fsync file contents to ensure durability.
451+
// `BufWriter::into_inner` flushes the buffer as well.
452452
let file = file_writer.into_inner().map_err(|err| {
453453
OperationError::service_error(format!("Failed to flush ID tracker point mappings: {err}"))
454454
})?;

0 commit comments

Comments
 (0)