Package ganeti :: Module mcpu :: Class _LockAttemptTimeoutStrategy
[hide private]
[frames] | no frames]

Class _LockAttemptTimeoutStrategy

source code


Class with lock acquire timeout strategy.

Instance Methods [hide private]
 
__init__(self, attempt=0, _time_fn=time.time, _random_fn=random.random)
Initializes this class.
source code
 
NextAttempt(self)
Returns the strategy for the next attempt.
source code
 
CalcRemainingTimeout(self)
Returns the remaining timeout.
source code

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

Class Variables [hide private]
  _TIMEOUT_PER_ATTEMPT = _CalculateLockAttemptTimeouts()
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, attempt=0, _time_fn=time.time, _random_fn=random.random)
(Constructor)

source code 

Initializes this class.

Parameters:
  • attempt (int) - Current attempt number
  • _time_fn - Time function for unittests
  • _random_fn - Random number generator for unittests
Overrides: object.__init__