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

Using the lockd API

lockd provides a light-weight implementation of a locking mechanism for long-running resources by maintaining lock files in a given directory.

>>> import tempfile
>>> lockdir = tempfile.mkdtemp()
>>> from gocept.lockd.lockd import Lockd
>>> daemon = Lockd(lockdir)

Resources are identified by a string and clients performing the lock are identified by another string:

>>> daemon.lock('resource1', 'client1')

Once a resource is locked, it can not be locked again:

>>> daemon.lock('resource1', 'client2')
Traceback (most recent call last):
Exception: Resource already locked by 'client1'

However, other resources can be locked in parallel:

>>> daemon.lock('resource2', 'client2')

Clients, other than the client who locked a resource, can not unlock it:

>>> daemon.unlock('resource1', 'client2')
Traceback (most recent call last):
Exception: Resource locked by 'client1' cannot be unlocked by 'client2'

The client, who locked the resource, can unlock it again:

>>> daemon.unlock('resource1', 'client1')

Once unlocked, it can not be unlocked a second time:

>>> daemon.unlock('resource1', 'client1')
Traceback (most recent call last):
Exception: Resource not locked

IMPORTANT security note

Resource identification and client authorization are out of scope for lockd. It should only be used and exposed within a trusted environment.

Cleanup:

>>> import shutil
>>> shutil.rmtree(lockdir)
Release History

Release History

0.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.1dev

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
gocept.lockd-0.1.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Dec 18, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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