polyswarmclient.bloom
¶
Module Contents¶
-
polyswarmclient.bloom.
get_chunks_for_bloom
(value_hash)[source]¶ -
Bloom filter helper function. Turn a value hash into
-
a series of chunks.
- Parameters
value_hash (bytes) – Hash of to be encoded into the Bloom filter.
- Yields
chunk (bytes) – Chunks of the value hash.
-
polyswarmclient.bloom.
chunk_to_bloom_bits
(chunk)[source]¶ -
Bloom filter helper function. Turn a chunk into a series of
-
actual bytes.
- Parameters
chunk (bytes) – Byte encoded chunk.
-
polyswarmclient.bloom.
get_bloom_bits
(value)[source]¶ -
Bloom filter helper function. Get the Bloom bits of a
-
given value.
- Parameters
value (bytes) – Value to be encoded into the Bloom filter.
-
class
polyswarmclient.bloom.
BloomFilter
(value=0)[source]¶ Bases:
numbers.Number
-
add
(self, value)[source]¶ Add a single byte value to the Bloom filter.
- Parameters
value (bytes) – Byte encoded value to add to Bloom filter.
-
extend
(self, iterable)[source]¶ Add an iterable of byte values to the bloom filter.
- Parameters
iterable (Iterable[bytes]) – Iterable of byte values.
-