Skip to content

feat(storage): add target_dedup_ratio and full_dedup_size - #13

Merged
admitrievtsev merged 3 commits into
Piletskii-Oleg:mainfrom
estoniec:kan-5
Jul 15, 2026
Merged

feat(storage): add target_dedup_ratio and full_dedup_size#13
admitrievtsev merged 3 commits into
Piletskii-Oleg:mainfrom
estoniec:kan-5

Conversation

@estoniec

@estoniec estoniec commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Vlm326 Vlm326 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В целом все хорошо, я бы только настоял на том чтобы убрать ненужную переменную

Comment thread src/system/storage.rs Outdated
}

fn full_dedup_size(&self) -> usize {
let size = self.database.iterator().fold(0, |acc, (_, container)| {

@Vlm326 Vlm326 Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно удалить переменную и просто возвращать напрямую результат функции

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Comment thread src/system/storage.rs
(self.size_written as f64) / (self.total_cdc_size() as f64)
}

fn full_dedup_size(&self) -> usize {

@Vlm326 Vlm326 Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мне кажется что стоит использоовать map + sum, такой подход будет более читаемым, тем более здесь нету какого то сохранения состояния, но это субъективно

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в соответствии с уже написанным кодом я принял решение использовать fold()

Comment thread src/system/storage.rs
}

fn target_dedup_size(&self) -> usize {
self.database.iterator().fold(0, |acc, (_, container)| {

@Vlm326 Vlm326 Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

аналогично я бы изменил на map + sum

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

то же самое

Comment thread src/system/storage.rs
.sum(),
}
})
}

@Vlm326 Vlm326 Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут нету комментариев с докой, хотя остальные публичные методы у нас задокументированны

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

@admitrievtsev admitrievtsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пойдёт

@admitrievtsev
admitrievtsev merged commit cb6f832 into Piletskii-Oleg:main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants