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

Add compression factory implementation #313

Merged
merged 5 commits into from
Mar 9, 2020

Conversation

piraka9011
Copy link
Contributor

Add implementation of the CompressionFactory.

Signed-off-by: Anas Abou Allaban aabouallaban@pm.me

@zmichaels11
Copy link
Contributor

Lets wait on #314 (review) to be merged before merging in this (with CI)

@zmichaels11
Copy link
Contributor

Merged #314 in so this PR is no longer blocked

Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
@zmichaels11
Copy link
Contributor

@ros2/aws-oncall @prajakta-gokhale @thomas-moulard - please run this CI job
Gist: https://gist.githubusercontent.com/zmichaels11/86917ffe79d5fd17a084a41a2229fb7c/raw/91a2fe26203675cad58b3fddc71544edd9d9a15e/ros2.repos
BUILD args: --packages-up-to rosbag2_compression
TEST args: --packages-select rosbag2_compression
Job: ci_launcher

@zmichaels11
Copy link
Contributor

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Collaborator

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@dabonnie dabonnie left a comment

Choose a reason for hiding this comment

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

Overall LGTM, some non-blocking comments

namespace
{

constexpr const char kCompressionFormatZstd[] = "zstd";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why anonymous? If not, then others can use and in the tests as well. Or another question, why not use the identifier provided by the zstd compressor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd need to make get_compression_identifier() static which I'd prefer to do in another PR. But yes that would make this less repetitive.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you can make BaseCompressorInterface::get_compression_identifier static since it needs to be implemented by each supported compression. You can add a static function to ZstdCompressor

TEST_F(CompressionFactoryTest, creates_zstd_compressor_caseinsensitive)
{
const auto compression_format = "ZsTd";
const auto lowercase_compression_format = to_lower(compression_format);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why reimplement case_insensitive_compare?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow this one. I need to verify that the compressor created is the correct one.
Are you suggesting that I instead use case_insensitive_compare to compare the compression format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be resolved by making get_compression_identifier() static as well.

TEST_F(CompressionFactoryTest, creates_zstd_compressor_uppercase)
{
const auto compression_format = "ZSTD";
const auto lowercase_compression_format = to_lower(compression_format);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

TEST_F(CompressionFactoryTest, creates_zstd_decompressor_caseinsensitive)
{
const auto compression_format = "ZsTd";
const auto lowercase_compression_format = to_lower(compression_format);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

Anas Abou Allaban added 2 commits March 9, 2020 13:31
Signed-off-by: Anas Abou Allaban <allabana@amazon.com>
Signed-off-by: Anas Abou Allaban <allabana@amazon.com>
@piraka9011
Copy link
Contributor Author

@ros2/aws-oncall - please run this CI job
Gist: https://gist.githubusercontent.com/piraka9011/6ab5f12949a4ed261ccf90fa70c56f0a/raw/91a2fe26203675cad58b3fddc71544edd9d9a15e/ros2.repos
BUILD args: --packages-up-to rosbag2_compression
TEST args: --packages-select rosbag2_compression
Job: ci_launcher

@zmichaels11
Copy link
Contributor

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@zmichaels11 zmichaels11 merged commit cf68df2 into ros2:master Mar 9, 2020
@zmichaels11 zmichaels11 deleted the split-comp-fix branch March 9, 2020 21:27
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.

None yet

5 participants