Skip to content

Conversation

pjsg
Copy link
Member

@pjsg pjsg commented Nov 18, 2017

Fixes #2175.

  • This PR is for the dev branch rather than for master.
  • This PR is compliant with the other contributing guidelines as well (if not, please describe why).
  • I have thoroughly tested my contribution.
  • The code changes are reflected in the documentation at docs/en/*.

This is a fairly simple implementation of a bloom filter object. The limits on how many objects you can store vary based on how much memory is available. However, storing 10,000 objects with a 1 false positive error rate consumes under 8k bytes of memory.

#include "../crypto/sha2.h"

#if defined(LUA_USE_MODULES_BLOOM) && !defined(SHA2_ENABLE)
#error Must have SHA2)ENABLE set for BLOOM module
Copy link
Member

Choose a reason for hiding this comment

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

) -> _



This module implements a bloom filter. This is a probabilistic data structure that is used to test for set membership. There are two operations -- `add` and `check` that allow
arbitrary strings to be added to the set or tested for set membership. Since this is a probabilistic dta structure, the answer returned can be incorrect. However,
Copy link
Member

Choose a reason for hiding this comment

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

dta -> data


This module implements a bloom filter. This is a probabilistic data structure that is used to test for set membership. There are two operations -- `add` and `check` that allow
arbitrary strings to be added to the set or tested for set membership. Since this is a probabilistic dta structure, the answer returned can be incorrect. However,
if the string *is* a member of the set, then the `check` operation will always return `true`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a link to https://en.wikipedia.org/wiki/Bloom_filter for further reading.

@marcelstoer marcelstoer added this to the 2.1 follow-up II milestone Nov 18, 2017
@pjsg
Copy link
Member Author

pjsg commented Nov 19, 2017

Thanks for fixing those issues 👍

@marcelstoer marcelstoer merged commit ef91580 into nodemcu:dev Dec 3, 2017
crasu pushed a commit to crasu/nodemcu-firmware that referenced this pull request Jan 11, 2018
* Initial checkin
* Add bloom.md into mkdocs
* Added reset and improved info
* Update bloom.c
* Update bloom.md
* Add Wikipedia link
dnc40085 pushed a commit to dnc40085/nodemcu-firmware that referenced this pull request Mar 3, 2018
* Initial checkin
* Add bloom.md into mkdocs
* Added reset and improved info
* Update bloom.c
* Update bloom.md
* Add Wikipedia link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants