This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Copyright (c) 2010 by Joachim Bauch, mail@joachim-bauch.de http://www.joachim-bauch.de/projects/python-continuum/

python-continuum provides a function to do consistent hashing. See wikipedia [1] for more informations about this technique.

First we need the continuum object that serves as storage for server informations and can later be used to resolve keys:

>>> from continuum import Continuum
>>> c = Continuum()

Empty continuums obviously can’t be queried:

>>> c.resolve('my-key1')
Traceback (most recent call last):
...
IndexError: empty continuum

Add the server objects that are available as backends:

>>> c.add_server('192.168.0.1', 8080)
<Server "192.168.0.1:8080", capacity=1>
>>> c.add_server('192.168.0.2', 8080)
<Server "192.168.0.2:8080", capacity=1>

You can also specify different capacities of the server to priorize them (this defaults to 1):

>>> c.add_server('192.168.0.3', 8080, 2)
<Server "192.168.0.3:8080", capacity=2>

Server objects can also be removed:

>>> server = c.add_server('192.168.0.4', 8080)
>>> c.remove_server(server)
>>> len(c)
3

Please note that a server can only be added once:

>>> c.add_server('192.168.0.2', 8080)
Traceback (most recent call last):
...
TypeError: server already added

After all servers have been added, the continuum can be queried for the server that should be used for a given (string) key:

>>> c.resolve('my-first-key')
<Server "192.168.0.1:8080", capacity=1>
>>> c.resolve('my-other-key')
<Server "192.168.0.3:8080", capacity=2>
[1]http://en.wikipedia.org/wiki/Consistent_hashing
Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python_continuum-0.1.1-py2.6.egg (5.7 kB) Copy SHA256 Checksum SHA256 2.6 Egg Nov 15, 2010
python-continuum-0.1.1.tar.gz (17.9 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting