Skip to content

Add bloom filter - #692

Merged
emmaz90 merged 2 commits into
SDKS-5521-MTKfrom
SDKS-5947
Jul 8, 2022
Merged

Add bloom filter#692
emmaz90 merged 2 commits into
SDKS-5521-MTKfrom
SDKS-5947

Conversation

@emmaz90

@emmaz90 emmaz90 commented Jul 7, 2022

Copy link
Copy Markdown
Contributor

JS SDK

What did you accomplish?

Created Bloom filter

How do we test the changes introduced in this PR?

Unit tests included

Extra Notes

@@ -0,0 +1,22 @@
import tape from 'tape-catch';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename the file to bloomFilter.spec.js, to indicate that this is the unit test for bloomFilter.js

Comment thread src/platform/filter/bloomFilter.js Outdated
@@ -0,0 +1,32 @@
import { BloomFilter } from '@ably/bloomit';

export function getBloomFilter(spectedInsertions, errorRate) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

expectedInsertions ? fix typo in all occurrences

Comment thread src/platform/filter/bloomFilter.js Outdated

if (spectedInsertions) __spectedInsertions = spectedInsertions;
if (errorRate) __errorRate = errorRate;
__filter = BloomFilter.create(__spectedInsertions, __errorRate);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can simplify lines 3 to 10 by using default parameters:

export function getBloomFilter(spectedInsertions = 10000000, errorRate = 0.01) {
  const __filter = BloomFilter.create(spectedInsertions, errorRate);

@emmaz90
emmaz90 merged commit e0cb1fa into SDKS-5521-MTK Jul 8, 2022
@emmaz90
emmaz90 deleted the SDKS-5947 branch July 8, 2022 18:54
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