Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ZENOTME committed Dec 6, 2024
1 parent fb161f3 commit 76ae53d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions crates/iceberg/src/spec/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,12 @@ impl ManifestWriter {
partition_summary
}

/// Add a new manifest entry.
pub fn add(&mut self, mut entry: ManifestEntry) -> Result<()> {
/// Add a new manifest entry. This method will update following status of the entry:
/// - Update the entry status to `Added`
/// - Set the snapshot id to the current snapshot id
/// - Set the sequence number to `None` if it is invalid(smaller than 0)
/// - Set the file sequence number to `None`
pub(crate) fn add(&mut self, mut entry: ManifestEntry) -> Result<()> {
if entry.sequence_number().is_some_and(|n| n >= 0) {
entry.status = ManifestStatus::Added;
entry.snapshot_id = Some(self.snapshot_id);
Expand All @@ -222,16 +226,27 @@ impl ManifestWriter {
Ok(())
}

/// Add a delete manifest entry.
pub fn delete(&mut self, mut entry: ManifestEntry) -> Result<()> {
/// Add a delete manifest entry. This method will update following status of the entry:
/// - Update the entry status to `Deleted`
/// - Set the snapshot id to the current snapshot id
///
/// # TODO
/// Remove this check after merge append.
#[allow(dead_code)]
pub(crate) fn delete(&mut self, mut entry: ManifestEntry) -> Result<()> {
entry.status = ManifestStatus::Deleted;
entry.snapshot_id = Some(self.snapshot_id);
self.add_entry(entry)?;
Ok(())
}

/// Add an existing manifest entry.
pub fn existing(&mut self, mut entry: ManifestEntry) -> Result<()> {
/// Add an existing manifest entry. This method will update following status of the entry:
/// - Update the entry status to `Existing`
///
/// # TODO
/// Remove this check after merge append.
#[allow(dead_code)]
pub(crate) fn existing(&mut self, mut entry: ManifestEntry) -> Result<()> {
entry.status = ManifestStatus::Existing;
self.add_entry(entry)?;
Ok(())
Expand Down

0 comments on commit 76ae53d

Please sign in to comment.