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 snappy compression #4336

Conversation

precious-void
Copy link

What does this PR do?

Adds Snappy compression adapter

Test Plan

Added 2 tests for Snappy compression similarly to ZSTD, both passed tests

Screen Shot 2022-10-08 at 18 48 53

Screen Shot 2022-10-08 at 18 48 37

  • testCreateBucketFileSnappyCompression
  • testFilePreviewSnappyCompression

Related PRs and Issues

Resolves #4002
Relates to my second PR #4002-utopia-php

Have you read the Contributing Guidelines on issues?

Yep :)

@precious-void precious-void changed the title Feat 4002 add snappy comporession Add snappy compression Oct 8, 2022
@Meldiron
Copy link
Contributor

@shtelzerartem , thanks for the PR! 🤯 Please give us some time to review it.

@stnguyen90 stnguyen90 self-requested a review October 28, 2022 21:39
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

Looks good! I'm going to add the hacktoberfest-accepted label, but the core team will need to clean up some things before this can be merged:

  • Update API specs
  • Bump utopia-php/storage in composer.json
  • Fix merge conflict

@stnguyen90 stnguyen90 added hacktoberfest-accepted Accepted for Hacktoberfest, will be merged later and removed hacktoberfest-accepted Accepted for Hacktoberfest, will be merged later labels Oct 28, 2022
Comment on lines +80 to +83
},
{
"url": "https://github.com/shtelzerartem/storage.git",
"type": "git"
Copy link
Member

Choose a reason for hiding this comment

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

reminder to remove this

Comment on lines +1 to +11
<?php
$home = $this->getParam('home', '');
$fileLimit = $this->getParam('fileLimit', 0);
$fileLimitHuman = $this->getParam('fileLimitHuman', 0);
$bucketPermissions = $this->getParam('bucketPermissions', null);
$fileCreatePermissions = $this->getParam('fileCreatePermissions', null);
$fileUpdatePermissions = $this->getParam('fileUpdatePermissions', null);
?>

<div
data-service="storage.getBucket"
Copy link
Member

Choose a reason for hiding this comment

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

@@ -65,7 +66,7 @@
->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true)
->param('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true)
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
->param('compression', COMPRESSION_TYPE_NONE, new WhiteList([COMPRESSION_TYPE_NONE, COMPRESSION_TYPE_GZIP, COMPRESSION_TYPE_ZSTD]), 'Compression algorithm choosen for compression. Can be one of ' . COMPRESSION_TYPE_NONE . ', [' . COMPRESSION_TYPE_GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . COMPRESSION_TYPE_ZSTD . '](https://en.wikipedia.org/wiki/Zstd), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true)
->param('compression', 'none', new WhiteList([COMPRESSION_TYPE_NONE, COMPRESSION_TYPE_GZIP, COMPRESSION_TYPE_ZSTD, COMPRESSION_TYPE_SNAPPY]), 'Compression algorithm choosen for compression. Can be one of ' . COMPRESSION_TYPE_NONE . ', [' . COMPRESSION_TYPE_GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . COMPRESSION_TYPE_ZSTD . '](https://en.wikipedia.org/wiki/Zstd), or [' . COMPRESSION_TYPE_SNAPPY . '](https://en.wikipedia.org/wiki/Snappy_(compression)), For file size above ' . Storage::human(APP_STORAGE_READ_BUFFER, 0) . ' compression is skipped even if it\'s enabled', true)
Copy link
Member

Choose a reason for hiding this comment

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

Please replace the string literals with the constants in all occurances in this file

Copy link
Member

@christyjacob4 christyjacob4 left a comment

Choose a reason for hiding this comment

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

Please address the comments

@christyjacob4
Copy link
Member

@shtelzerartem thanks a lot for your contributions during Hacktoberfest 2022!

Please reach out to me on our Discord server if you would like to claim your Appwrite swags! As a way of saying thank you, we would also love to invite you to join the Appwrite organization on GitHub. Please share your GitHub username with us on Discord. 

I'm closing this PR as there has not been any activity on this for quite a while. If you'd like to continue working on it , feel free to create a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted for Hacktoberfest, will be merged later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🗜️ Refine Appwrite Storage with Snappy Compression
4 participants