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.

Install

The package name is different to the import name. The install name is cjrh-scalable-cuckoo-filter but the import name is scf. This is because the package name must be unique on PyPI, and scalable-cuckoo-filter was already taken.

Install:

$ pip install cjrh-scalable-cuckoo-filter

Import:

import scf
from scf import PyScalableCuckooFilter

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.2.tar.gz (8.9 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.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (286.7 kB view details)

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

cjrh_scalable_cuckoo_filter-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (276.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

File details

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

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5a5ce1a4eb75efccf72f796b757c5b70426102c3f6eceb4c03feb6d019192b5b
MD5 99303511aa3de0179e3370579449da47
BLAKE2b-256 85b3af7ce63fe1f7d901cc494c201c897596d3cd500df0f3568d322899a38bee

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2.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.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4d566acc1378bf8a38b90de0727bd39a394a75deca74a4b9035ea8359fa051e8
MD5 4289b0cb8d2cc07cecfc03af6e99c68c
BLAKE2b-256 efe1dbab017c1b9d98843b3e2e02d461a654c15417d37de961b814f27a3dceec

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3fa82dc0076bc881c73cbe0904d92d27d568f3ea9b10b3e54e93636a024d3161
MD5 4eec3ee2ee607f25c0b3292a39f7e1f9
BLAKE2b-256 2e88dfd5341bc0e273003d49809f9244d3dd8a3a52f72a1c93e8079001e2cb63

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb91f174e6ad6329ccc07ff32f84c83c56c9a65c3d18a0aa056d851b930b2d01
MD5 c7690c5de7963cb53c307f71ad9757e5
BLAKE2b-256 9d3411cf4822c6bb480d290a3c791ba1377bf262ff41c97a392f437ec7c863c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 73b34d51367a7d3fdaabd40f956fec0dfe23949b2eec3ae094c5b241eab3bd07
MD5 551c236ce2e6c028ba89bc8851c17c0b
BLAKE2b-256 dadf43f705df23b67f7e51d61f78e55d948ec8c76c1e57debf27eca3b6ba9b98

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6aaa6c75becbcadca2ce361c75556e2e6538ca4f1886b8b7c0a816ac4af8929
MD5 deb5f15da4b6616dc0a2ab78b1e0787a
BLAKE2b-256 2fceab5e0bd8e4d45a924faf0d7163e39259c0e7bbfc01c702cd85cfa608a6bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cjrh_scalable_cuckoo_filter-0.3.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c7c81d2f0d163954239082ad6c4b9fecee8b23640a485b6121c083ab940d9906
MD5 c443eff994356ba0a4cd3d9d9b31a5ec
BLAKE2b-256 f7e560b3701d32f6cd1a307a561c389427ff3d227deb64294941f8833eeba199

See more details on using hashes here.

Provenance

The following attestation bundles were made for cjrh_scalable_cuckoo_filter-0.3.2-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