Skip to content

Zdelta#10

Merged
maxscherbakov merged 18 commits intomaxscherbakov:mainfrom
ArtemNikit1n:zdelta
Jul 31, 2025
Merged

Zdelta#10
maxscherbakov merged 18 commits intomaxscherbakov:mainfrom
ArtemNikit1n:zdelta

Conversation

@ArtemNikit1n
Copy link
Collaborator

No description provided.

Copy link
Owner

@maxscherbakov maxscherbakov left a comment

Choose a reason for hiding this comment

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

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

Comment on lines +71 to +73
Err(_) => {
panic!("Chunk is too small (Chunk size should be at least three bytes)")
}
Copy link
Owner

Choose a reason for hiding this comment

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

Как я и говорил мы можем не предполагать что у нас чанки длинной меньше 3 байт. За эту часть отвечает CDC алгоритм.

@@ -0,0 +1,52 @@
use thiserror::Error;
Copy link
Owner

Choose a reason for hiding this comment

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

Весь этот файл - очень круто.

let mut previous_match_offset: Option<i16> = None;
let mut bit_vec_delta_code = BitVec::new();

let mut i : PositionInChunk = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

А вот это не очень. Лучше назвать переменную говорящим именем. В целом PositionInChunk это простой usize лучше так не делать. В отдельный тип лучше выносить какие-то сложные, длинные или трудночитаемые типы.

Comment on lines 124 to 125
let data_to_decode = if self.huffman_tree.is_some() {
let decoded = self.huffman_to_raw(delta_code);
Copy link
Owner

Choose a reason for hiding this comment

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

Насколько я понял huffman_to_raw() уже включает проверку is_some() или тут какой-то принципиально важный кусок алгоритма?

delta_code.to_vec()
};

let mut i = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

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

@maxscherbakov maxscherbakov merged commit a2d822a into maxscherbakov:main Jul 31, 2025
@ArtemNikit1n ArtemNikit1n deleted the zdelta branch July 31, 2025 21:00
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.

2 participants