Skip to main content

Scalable Cuckoo Filter implemented in Rust with Python bindings

Project description

scalable-cuckoo-filter-py

Python wrapper for sile/scalable_cuckoo_filter

See the crate that this wraps: https://docs.rs/scalable_cuckoo_filter/

This can be used as a probabilistic data structure for set membership tests. A cuckoo filter is similar to a Bloom filter, but it supports deletions.

This implementation is scalable, meaning that it can grow and shrink dynamically while maintinaing a low false positive rate.

Usage

Create the filter and add a few strings:

from scf import PyScalableCuckooFilter


scf = PyScalableCuckooFilter(1000, 0.001)
scf.insert("hello")
scf.insert("world")

Now we can do membership tests:

assert scf.might_contain("hello")
assert scf.might_contain("world")
assert not scf.might_contain("foo")

We can remove entries:

scf.remove("hello")
assert not scf.might_contain("hello")

We can save the filter to a file:

scf.write_to_file("filter.bin")

And load it back:

scf = PyScalableCuckooFilter.read_from_file("filter.bin")
assert scf.might_contain("world")

Types

These are the the types that can be used with the filter:

  • str
  • bytes
  • bytearray
  • int
  • float
  • bool
  • Iterables of the above types, with nesting.

For example, you can insert a list of integers:

scf = PyScalableCuckooFilter(1000, 0.001)
scf.insert([1, 2, 3])  # list
scf.insert([1, (2, [3])])  # list(tuple(list)))

However, note that all iterables will hash the same as each other. For example, ["foo", "bar"] and ("foo", "bar") will be regarded as the same key. In fact, any iterable with the same elements will hash the same.

scf = PyScalableCuckooFilter(1000, 0.001)
scf.insert(range(3))  # iterable
assert scf.might_contain((0, 1, 2))  # tuple

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cjrh_scalable_cuckoo_filter-0.3.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (286.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (276.7 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1.tar.gz.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d0cd265855bcb8ed3453588f9c1ed2e55284115598155f916a2f340a162f1904
MD5 f5cc86bc9758a2f5297525ace9280356
BLAKE2b-256 494900700d9881ed555bd7c6a656bbfaccb3c59d5502890839d8595e2711bad3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1.tar.gz:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3be211dd764940043e62a26439bb09c5a9020356766f61b858d333efd4c01fd3
MD5 92ea5d3ced8f794b5d767130ae0d01ec
BLAKE2b-256 eaaa50c7f5569cdb2ec3919ca6defa7b5cb2c5b6c66430107b0c7c0908405583

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb2871ff88d09a8aeaa8b8027d7bd1d0f689df5b4cbe64a74d2e4dce399208f6
MD5 e2aea2cbae6a279dbc77ca73858bdd99
BLAKE2b-256 363d9d9b77137f1f2883887a171de4b1b35a5d6ff6c90fa0e15da95f2e3eb527

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 762823cc234ccbef3eaf8b2117e7e367f24c110fbb8fa58ecb71db335b3e9c05
MD5 31dfe18383ada51d41c0e70c9b2b8210
BLAKE2b-256 c22597cbabd5520c30e3f868cd901a3546fd19b4f0e57ce6f508eea4c5da47c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2dc56ff9e551e9fddf7839c7720136a2fbb886d4a2a997b9e85218d85ec15b0
MD5 bb092ad8581c8ba1c3f5290820ddea28
BLAKE2b-256 e41bb9ecdc558bda8d2723eb83e7b11c6824b778f892c44428b14b7014585256

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4773a0c466db0de2a643569f113569eba5cda0054ad7c51efe3d6d16846d7637
MD5 64428ff7248699e9777c2d9457ec8945
BLAKE2b-256 e5efbacf46b5620bf98f10264c5d8526afd4a7d45344eb1603f1694973283457

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fd46e40eaff82e764f20159f5423015a17e6149a7d7a037b9cfc35953dcc55ed
MD5 fb85e89d54a060291f54661d8b7d5d9d
BLAKE2b-256 d4b450a1f1419bcc9e9911abcd81ce8dd16162080e4402d27834987e3ac625c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on cjrh/scalable-cuckoo-filter-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page