Package entropy :: Module locks :: Class EntropyResourcesLock

Class EntropyResourcesLock

source code


Entropy Resources Lock (or Big Entropy Lock, BEL) class.

This class wraps the interface to the Entropy Resources Lock, for acquiring shared or exclusive access to the Entropy Package Manager.

Typically, routines acquire this lock in shared mode and only a handful of code paths require exclusive locking.

Instance Methods
 
__init__(self, output=None)
Object constructor.
source code
 
path(self)
Return the path to the lock file.
source code

Inherited from ResourceLock: acquire_exclusive, acquire_shared, exclusive, is_already_acquired, release, shared, try_acquire_exclusive, try_acquire_shared, wait_exclusive, wait_shared

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
add_post_acquire_hook(cls, callab)
Add a hook that will be executed once the lock is acquired.
source code
 
remove_post_acquire_hook(cls, index)
Remove a previously added hook using its reference.
source code
Properties

Inherited from object: __class__

Method Details

add_post_acquire_hook(cls, callab)
Class Method

source code 

Add a hook that will be executed once the lock is acquired. This can be used to execute cache cleanups or other activities of the same sort. The callable is called with the EntropyCacher lock held.

This method returns a reference number that must be used to perform the removal of the hook.

remove_post_acquire_hook(cls, index)
Class Method

source code 

Remove a previously added hook using its reference.

This method raises KeyError if the hook is not present.

__init__(self, output=None)
(Constructor)

source code 

Object constructor.

Parameters:
  • output (entropy.output.TextInterface or None) - a TextInterface interface
Overrides: object.__init__

path(self)

source code 

Return the path to the lock file.

Overrides: ResourceLock.path