Package ganeti :: Module locking :: Class LockMonitor
[hide private]
[frames] | no frames]

Class LockMonitor

source code


Instance Methods [hide private]
 
__init__(self)
Initializes this class.
source code
 
RegisterLock(self, provider)
Registers a new lock.
source code
 
_GetLockInfo(self, requested)
Get information from all locks.
source code
 
_Query(self, fields)
Queries information from all locks.
source code
 
QueryLocks(self, fields)
Queries information from all locks.
source code

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

Class Variables [hide private]
  _LOCK_ATTR = "_lock"
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initializes this class.

Overrides: object.__init__

RegisterLock(self, provider)

source code 

Registers a new lock.

Parameters:
  • provider - Object with a callable method named GetLockInfo, taking a single set containing the requested information items
Decorators:
  • @ssynchronized(_LOCK_ATTR)

Note: It would be nicer to only receive the function generating the requested information but, as it turns out, weak references to bound methods (e.g. self.GetLockInfo) are tricky; there are several workarounds, but none of the ones I found works properly in combination with a standard WeakKeyDictionary

_Query(self, fields)

source code 

Queries information from all locks.

Parameters:
  • fields (list of strings) - List of fields to return

QueryLocks(self, fields)

source code 

Queries information from all locks.

Parameters:
  • fields (list of strings) - List of fields to return