Skip to main content

Client library to interface with multiple bloomd servers

Project description

bloom-python-driver
=========

Pybloom provides a Python client library to interface with
bloomd servers. The library supports multiple bloomd servers,
and automatically handles filter discovery and sharding.

Features
--------


* Provides a simple API for using bloomd
* Allows for using multiple bloomd servers
- Auto-discovers filter locations
- Balance the creation of new filters
- Explicitly name the location to make filters
* Command pipelining to reduce latency


Install
-------

Download and install from source:

python setup.py install

Example
------

Using pybloom is very simple, and is similar to using native sets::

from pybloom import BloomdClient

# Create a client to a local bloomd server, default port
client = BloomdClient(["localhost"])

# Get or create the foobar filter
foobar = client.create_filter("foobar")

# Set a property and check it exists
foobar.add("Test Key!")
assert "Test Key!" in foobar

To support multiple servers, just add multiple servers::

from pybloom import BloomdClient

# Create a client to a multiple bloomd servers, default ports
client = BloomdClient(["bloomd1", "bloomd2"])

# Create 4 filters, should be on different machines
for x in xrange(4):
client.create_filter("test%d" % x)

# Show which servers the filters are on by
# specifying the inc_server flag
print client.list_filters(inc_server=True)

# Use the filters
client["test0"].add("Hi there!")
client["test1"].add("ZING!")
client["test2"].add("Chuck Testa!")
client["test3"].add("Not cool, bro.")


Using pipelining is straightforward as well::

from pybloom import BloomdClient

# Create a client to a local bloomd server, default port
client = BloomdClient(["localhost"])

# Get or create the foobar filter
pipe = client.create_filter("pipe").pipeline()

# Chain multiple add commands
results = pipe.add("foo").add("bar").add("baz").execute()
assert results[0]
assert results[1]
assert results[2]

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

pybloomd-0.4.6.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file pybloomd-0.4.6.tar.gz.

File metadata

  • Download URL: pybloomd-0.4.6.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybloomd-0.4.6.tar.gz
Algorithm Hash digest
SHA256 7ecac37c47f8361781ed7886fa7ad294b0117d19504f2d5f0fc0648932d4cc70
MD5 da6d31e8c63ba158a8a41047faea68cd
BLAKE2b-256 7ecb4002e2cba617d3f7b9ca3f12cd5b72a42c62e5c08dfdf362ba0491d35a05

See more details on using hashes here.

Supported by

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