Skip to content

Add estimated_size for Block structure #130

@ppdogg

Description

@ppdogg

There has already been a function estimated_size in SsTableBuilder. I think it is fair to add the same function to BlockBuilder structure:

impl BlockBuilder {
     pub fn estimated_size(&self) -> usize {}
}

Doing this has two benefits:

  1. Making the estimated_size in SsTableBuilder more precise:
pub fn estimated_size(&self) -> usize {
    self.data.len() + self.builder.estimated_size()
}

Because during the process of building table, there may be some data in block builder that are not taken into count.

  1. In function compact of compact.rs, we can use estimated_size of SsTableBuilder to find if there are some data left:
if builder.estimated_size() > 0 {}

I have read your code in checkpoint, and I think this eliminates the need to use Option as a wrapper of SsTableBuilder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions