Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed stream file output #41

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Compressed stream file output #41

merged 2 commits into from
Oct 11, 2023

Conversation

Daniil-Golikov
Copy link
Contributor

In this PR, enhancements and refactoring have been made related to writing binary streams to files

Migrated to New Compressed Stream System:

  • Transitioned to the new CompressedStream objects

Modularized Functionality:

  • Introduced separate functions for processing directories (process_directory) and individual files (process_single_file). This separation allows for clearer code, easier maintenance
  • Introduced a new function, compress_data, which abstracts away the compression logic. This makes it more straightforward to change or extend compression methods.
  • Introduced a function write_compressed_data_to_path which centralizes the writing logic for the compressed data.

All the feedback is welcome

@Daniil-Golikov Daniil-Golikov requested a review from cjrolo October 11, 2023 07:35

/// Processes a single file.
fn process_single_file(path: &Path, arguments: &Args) {
if let Some((vec, tag)) = reader::read_file(path).expect("Failed to read file") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A lot of the error control here is always related to handling files. Either chain and propagate the error via ? or "unwrap()" and let it panic in case of failure anyway (We can't proceed and we haven't done anything at this stage).

Copy link
Collaborator

@cjrolo cjrolo left a comment

Choose a reason for hiding this comment

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

The code works and I'm merging. The comment can be addressed in another pull request.

@rukai rukai merged commit 36007a1 into main Oct 11, 2023
2 checks passed
@Daniil-Golikov Daniil-Golikov deleted the compressed-stream-file-output branch October 11, 2023 23:05
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