-
Notifications
You must be signed in to change notification settings - Fork 74
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(core): Add boilerplate for LZMA decompressor. #708
feat(core): Add boilerplate for LZMA decompressor. #708
Conversation
WalkthroughThis pull request introduces new LZMA decompression functionality within the streaming compression framework. It adds new source files ( Changes
Suggested Reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
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
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp
Outdated
Show resolved
Hide resolved
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: 0
🧹 Nitpick comments (4)
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp (1)
18-20
: Consider adding TODO comments for future implementation.All methods are currently stubs that either return
ErrorCode_Unsupported
or throwOperationFailed
. While this is acceptable for an initial interface, adding TODO comments would help track which methods need implementation.Add TODO comments to each method, for example:
auto Decompressor::try_read( [[maybe_unused]] char* buf, [[maybe_unused]] size_t num_bytes_to_read, [[maybe_unused]] size_t& num_bytes_read ) -> ErrorCode { + // TODO: Implement LZMA decompression logic return ErrorCode_Unsupported; }
Also applies to: 22-24, 26-31, 33-38, 40-42, 44-50
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp (3)
35-41
: Consider documenting rationale for deleted move operations.The TODO comment explains that move operations will be defaulted when the base class is updated. Consider documenting why move operations are currently deleted to help future maintainers.
Add a comment explaining the rationale:
// Delete move constructor and assignment operator -// TODO: Change to default when the base decompressor class has been updated. +// TODO: Change to default when the base decompressor class has been updated +// Move operations are currently deleted because the base class does not support them Decompressor(Decompressor&&) noexcept = delete; auto operator=(Decompressor&&) noexcept -> Decompressor& = delete;
44-67
: Improve documentation consistency.The documentation style should be consistent across all methods. Some improvements needed:
- Add periods at the end of parameter descriptions
- Use "Returns" for output parameters
- Add periods at the end of return value descriptions
Apply these changes to the documentation:
/** * Tries to read up to a given number of bytes from the decompressor. - * @param buf + * @param buf The buffer to read into. * @param num_bytes_to_read The number of bytes to try reading. - * @param num_bytes_read Returns the actual number of bytes read. + * @param num_bytes_read Returns the actual number of bytes read. - * @return ErrorCode_Unsupported + * @return ErrorCode_Unsupported. */
85-88
: Add complete method documentation.The
close()
method lacks a proper description of its purpose and behaviour.Add complete documentation:
-/* +/** + * Closes the decompressor and releases any resources. * @throw clp::streaming_compression::lzma::Decompressor::OperationFailed if unsupported. */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp
(1 hunks)components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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: centos-stream-9-static-linked-bins
- GitHub Check: ubuntu-jammy-static-linked-bins
- GitHub Check: ubuntu-focal-dynamic-linked-bins
- GitHub Check: centos-stream-9-dynamic-linked-bins
- GitHub Check: ubuntu-jammy-dynamic-linked-bins
- GitHub Check: build-macos (macos-14, false)
- GitHub Check: build-macos (macos-14, true)
- GitHub Check: build-macos (macos-13, false)
- GitHub Check: lint-check (ubuntu-latest)
- GitHub Check: build-macos (macos-13, true)
- GitHub Check: lint-check (macos-latest)
🔇 Additional comments (2)
components/core/src/clp/streaming_compression/lzma/Decompressor.cpp (1)
10-16
: LGTM! Method signature and implementation are correct.The implementation correctly returns
ErrorCode_Unsupported
as a placeholder. The use of[[maybe_unused]]
for parameters is appropriate since they are not used in the current implementation.components/core/src/clp/streaming_compression/lzma/Decompressor.hpp (1)
16-26
: LGTM! Inner exception class is well-defined.The
OperationFailed
exception class correctly extendsTraceableException
and provides a clear error message. The use of[[nodiscard]]
andnoexcept
is appropriate.
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
components/core/src/clp/streaming_compression/lzma/Decompressor.hpp
Outdated
Show resolved
Hide resolved
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.
For the PR title, how about:
feat(core): Add boilerplate for LZMA decompressor.
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 decompression operations.Tests
The changes enhance the project's compression capabilities by integrating LZMA decompression, improving data handling flexibility.