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

Compression updates v2 #511

Merged
merged 19 commits into from
Oct 14, 2022
Merged

Conversation

jaytist
Copy link
Contributor

@jaytist jaytist commented Oct 3, 2022

Please check if the PR fulfills these requirements

  • Followed the Contributing guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
compression updates

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (1a04130) compared to base (c877fb0).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #511   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         6    +1     
  Lines          319       341   +22     
=========================================
+ Hits           319       341   +22     
Impacted Files Coverage Δ
packages/test-suite/src/compression.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

packages/compress-brotli/src/index.js Outdated Show resolved Hide resolved
packages/compress-brotli/src/index.js Outdated Show resolved Hide resolved
packages/compress-gzip/src/index.d.ts Outdated Show resolved Hide resolved
packages/compress-gzip/src/index.js Outdated Show resolved Hide resolved
packages/compress-gzip/src/index.js Outdated Show resolved Hide resolved
packages/keyv/src/index.d.ts Outdated Show resolved Hide resolved
@jaredwray
Copy link
Owner

@alphmth - how would we separate this out so that serialize, deserialized could exist without being part of the compression package or maybe an option that if those functions exist we use it otherwise we use what is set?

@jaytist
Copy link
Contributor Author

jaytist commented Oct 6, 2022

@alphmth - how would we separate this out so that serialize, deserialized could exist without being part of the compression package or maybe an option that if those functions exist we use it otherwise we use what is set?

@jaredwray In the set or get method we are using serialize and deserialize methods. To make compression work we need to add compress/decompress method in the serialize/deserialize method. If we make them optional how we will use compression in main keyv project?

@jaredwray
Copy link
Owner

@alphmth - this is starting to come together. One other thought is to create another export of the test-suite library that does validation of the compression packages so third parties can do that. Can you add that in?

@jaytist
Copy link
Contributor Author

jaytist commented Oct 11, 2022

@jaredwray do we need to add serialize/deserialize as optional? In that case, the user will have to use compress/decompress methods like this

const gzip = new KeyvGzip(); 
const compressedValue = gzip.compressed(value);
const keyv = new Keyv({store: new Map()});
await keyv.set('test-key', compressedValue, 1000);

//get compressed value
const decompressedValue = await gzip.decompressed(await keyv.get('test-key));

@jaredwray
Copy link
Owner

@jaredwray do we need to add serialize/deserialize as optional? In that case, the user will have to use compress/decompress methods like this

const gzip = new KeyvGzip(); 
const compressedValue = gzip.compressed(value);
const keyv = new Keyv({store: new Map()});
await keyv.set('test-key', compressedValue, 1000);

//get compressed value
const decompressedValue = await gzip.decompressed(await keyv.get('test-key));

Lets go with the current architecture for right now and then will take feedback.

@jaytist jaytist requested a review from jaredwray October 13, 2022 16:17
@jaredwray jaredwray dismissed their stale review October 14, 2022 19:49

verified

@jaredwray jaredwray merged commit 251570e into jaredwray:main Oct 14, 2022
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.

2 participants