-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat(clp-core): Add LZMA decompressor interface. #708
base: main
Are you sure you want to change the base?
feat(clp-core): Add LZMA decompressor interface. #708
Conversation
WalkthroughThis pull request introduces a new LZMA decompression implementation within the streaming compression framework. The changes include adding new source files ( Changes
Possibly Related PRs
Suggested Reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp (2)
16-26
: Consider a more descriptive name for the exception class.
WhileOperationFailed
is functional, a more domain-specific name (e.g.UnsupportedOperation
) may help clarify its intended usage and differentiate it from general operation failures.
39-42
: Follow up on the TODO for the move constructor and assignment operators.
You have a TODO indicating these could be defaulted once the base class has been updated. Ensure there is a tracked task or issue to revisit them.components/core/tests/test-StreamingCompression.cpp (1)
137-137
: No call todecompress_and_compare
.
Currently, you instantiate the LZMA decompressor but do not invokedecompress_and_compare
. If full testing is planned, consider adding calls to verify the behaviour of the LZMA decompressor once implemented.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
components/core/CMakeLists.txt
(1 hunks)components/core/src/clp/streaming_compression/lzma/Decompressor.cpp
(1 hunks)components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
(1 hunks)components/core/tests/test-StreamingCompression.cpp
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
components/core/tests/test-StreamingCompression.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: ubuntu-focal-static-linked-bins
- GitHub Check: ubuntu-jammy-static-linked-bins
- GitHub Check: centos-stream-9-static-linked-bins
- GitHub Check: ubuntu-focal-dynamic-linked-bins
- GitHub Check: ubuntu-jammy-dynamic-linked-bins
- GitHub Check: centos-stream-9-dynamic-linked-bins
- GitHub Check: build-macos (macos-14, false)
- GitHub Check: build-macos (macos-14, true)
- GitHub Check: lint-check (ubuntu-latest)
- GitHub Check: build-macos (macos-13, false)
- GitHub Check: build (macos-latest)
- GitHub Check: build-macos (macos-13, true)
🔇 Additional comments (4)
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp (1)
43-67
: Confirm the non-implementation of ReaderInterface methods.
All these methods returnErrorCode_Unsupported
, which is valid for now. However, please confirm if this is the final intended behaviour or if you plan to implement actual read and position control functionality in future.components/core/src/clp/streaming_compression/lzma/Decompressor.cpp (1)
9-16
: Placeholder for read operations.
Thetry_read
implementation is returningErrorCode_Unsupported
. This is fine as a placeholder, but remember to provide an actual LZMA-compatible read implementation if you intend to handle partial reads.components/core/tests/test-StreamingCompression.cpp (1)
21-21
: Good inclusion of the new LZMA Decompressor header.
This inclusion ensures the LZMA decompressor can be instantiated and tested.components/core/CMakeLists.txt (1)
543-544
: LGTM! The new LZMA decompressor files are properly integrated.The files are correctly added to the
SOURCE_FILES_unitTest
variable and are grouped with other compression-related source files.Let's verify the LZMA library configuration:
✅ Verification successful
Verified: LZMA decompressor files are correctly placed and configured
- LZMA library is properly configured with version, location, and include directory checks
- New decompressor files follow the project's structure, matching other compression implementations:
- components/core/src/clp/streaming_compression/lzma/Decompressor.cpp
- components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify LZMA library configuration and source files. # Test 1: Check if LZMA library is properly configured echo "Verifying LZMA library configuration..." rg -A 5 "LIBLZMA_FOUND" # Test 2: Verify the existence of the new source files echo "Verifying source files..." fd -t f "Decompressor\.(cpp|hpp)$" "src/clp/streaming_compression/lzma"Length of output: 847
Script:
#!/bin/bash # Search for Decompressor files and LZMA-related files echo "Searching for Decompressor files..." fd -t f "Decompressor\.(cpp|hpp)$" echo -e "\nSearching for LZMA-related source files..." fd -t f -e cpp -e hpp ".*lzma.*" echo -e "\nChecking source directory structure..." fd -t d "streaming_compression"Length of output: 1639
auto open(char const* compressed_data_buf, size_t compressed_data_buf_size) -> void override; | ||
|
||
/** | ||
* Initializes the decompressor to decompress from an open file | ||
* @param file_reader | ||
* @param file_read_buffer_capacity The maximum amount of data to read from a file at a time | ||
* @throw clp::streaming_compression::lzma::Decompressor::OperationFailed if unsupported | ||
*/ | ||
auto open(ReaderInterface& file_reader, size_t file_read_buffer_capacity) -> void override; | ||
|
||
/* | ||
* @throw clp::streaming_compression::lzma::Decompressor::OperationFailed if unsupported | ||
*/ | ||
auto close() -> void override; | ||
|
||
/** | ||
* Decompresses and copies the range of uncompressed data described by decompressed_stream_pos | ||
* and extraction_len into extraction_buf. | ||
* @param decompressed_stream_pos | ||
* @param extraction_buf | ||
* @param extraction_len | ||
* @return ErrorCode_Unsupported | ||
*/ | ||
[[nodiscard]] auto get_decompressed_stream_region( | ||
size_t decompressed_stream_pos, | ||
char* extraction_buf, | ||
size_t extraction_len | ||
) -> ErrorCode override; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Implement or remove unimplemented Decompressor interface methods.
The current placeholders throw or return ErrorCode_Unsupported
. If this interface is to be fully supported eventually, consider adding partial or full LZMA decompression logic, or remove these declarations if they are truly never intended to be used.
auto Decompressor::open( | ||
[[maybe_unused]] char const* compressed_data_buf, | ||
[[maybe_unused]] size_t compressed_data_buf_size | ||
) -> void { | ||
throw OperationFailed(ErrorCode_Unsupported, __FILENAME__, __LINE__); | ||
} | ||
|
||
auto Decompressor::open( | ||
[[maybe_unused]] ReaderInterface& file_reader, | ||
[[maybe_unused]] size_t file_read_buffer_capacity | ||
) -> void { | ||
throw OperationFailed(ErrorCode_Unsupported, __FILENAME__, __LINE__); | ||
} | ||
|
||
auto Decompressor::close() -> void { | ||
throw OperationFailed(ErrorCode_Unsupported, __FILENAME__, __LINE__); | ||
} | ||
|
||
[[nodiscard]] auto Decompressor::get_decompressed_stream_region( | ||
[[maybe_unused]] size_t decompressed_stream_pos, | ||
[[maybe_unused]] char* extraction_buf, | ||
[[maybe_unused]] size_t extraction_len | ||
) -> ErrorCode { | ||
return ErrorCode_Unsupported; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Populate methods with real decompression logic.
Each method simply raises OperationFailed
or returns ErrorCode_Unsupported
. Before deployment, ensure to replace these stubs with meaningful logic to handle LZMA data.
Description
Decompressor
class, with only the essential functions that require overriding.ErrorCode_Unsupported
.CMakeLists.txt
to include the new files.clang-tidy
.Checklist
Validation performed
Summary by CodeRabbit
New Features
Decompressor
class for handling LZMA compression-related operationsTests
The changes expand the project's compression capabilities by introducing a new LZMA decompression mechanism, providing enhanced data handling flexibility.