MediaWiki
REL1_19
|
Class for handling resource locking. More...
Public Member Functions | |
__construct (array $config) | |
Construct a new instance from configuration. | |
lock (array $paths, $type=self::LOCK_EX) | |
Lock the resources at the given abstract paths. | |
unlock (array $paths, $type=self::LOCK_EX) | |
Unlock the resources at the given abstract paths. | |
Public Attributes | |
const | LOCK_EX = 3 |
const | LOCK_SH = 1 |
const | LOCK_UW = 2 |
Protected Member Functions | |
doLock (array $paths, $type) | |
Lock resources with the given keys and lock type. | |
doUnlock (array $paths, $type) | |
Unlock resources with the given keys and lock type. | |
Static Protected Member Functions | |
static | sha1Base36 ($path) |
Get the base 36 SHA-1 of a string, padded to 31 digits. | |
Protected Attributes | |
$locksHeld = array() | |
$lockTypeMap |
Class for handling resource locking.
Locks on resource keys can either be shared or exclusive.
Implementations must keep track of what is locked by this proccess in-memory and support nested locking calls (using reference counting). At least LOCK_UW and LOCK_EX must be implemented. LOCK_SH can be a no-op. Locks should either be non-blocking or have low wait timeouts.
Subclasses should avoid throwing exceptions at all costs.
Definition at line 28 of file LockManager.php.
LockManager::__construct | ( | array $ | config | ) |
Construct a new instance from configuration.
$config | Array |
Reimplemented in DBLockManager, LSLockManager, and FSLockManager.
Definition at line 49 of file LockManager.php.
LockManager::doLock | ( | array $ | paths, |
$ | type | ||
) | [abstract, protected] |
Lock resources with the given keys and lock type.
$paths | Array List of storage paths |
$type | integer LockManager::LOCK_* constant |
Reimplemented in NullLockManager, DBLockManager, LSLockManager, and FSLockManager.
Referenced by lock().
LockManager::doUnlock | ( | array $ | paths, |
$ | type | ||
) | [abstract, protected] |
Unlock resources with the given keys and lock type.
$paths | Array List of storage paths |
$type | integer LockManager::LOCK_* constant |
Reimplemented in NullLockManager, DBLockManager, LSLockManager, and FSLockManager.
Referenced by unlock().
LockManager::lock | ( | array $ | paths, |
$ | type = self::LOCK_EX |
||
) | [final] |
Lock the resources at the given abstract paths.
$paths | Array List of resource names |
$type | integer LockManager::LOCK_* constant |
Definition at line 58 of file LockManager.php.
References doLock().
Referenced by ScopedLock\factory().
static LockManager::sha1Base36 | ( | $ | path | ) | [static, final, protected] |
Get the base 36 SHA-1 of a string, padded to 31 digits.
$path | string |
Definition at line 79 of file LockManager.php.
References $path, and wfBaseConvert().
Referenced by FSLockManager\getLockPath().
LockManager::unlock | ( | array $ | paths, |
$ | type = self::LOCK_EX |
||
) | [final] |
Unlock the resources at the given abstract paths.
$paths | Array List of storage paths |
$type | integer LockManager::LOCK_* constant |
Definition at line 69 of file LockManager.php.
References doUnlock().
LockManager::$locksHeld = array() [protected] |
Definition at line 37 of file LockManager.php.
LockManager::$lockTypeMap [protected] |
array( self::LOCK_SH => self::LOCK_SH, self::LOCK_UW => self::LOCK_EX, self::LOCK_EX => self::LOCK_EX )
Reimplemented in MySqlLockManager, LSLockManager, and FSLockManager.
Definition at line 30 of file LockManager.php.
const LockManager::LOCK_EX = 3 |
Definition at line 42 of file LockManager.php.
Referenced by FileBackendStore\doClean(), FileBackendMultiWrite\doOperationsInternal(), FileBackendStore\doOperationsInternal(), and FSLockManager\doSingleLock().
const LockManager::LOCK_SH = 1 |
Definition at line 40 of file LockManager.php.
Referenced by FSLockManager\doSingleLock().
const LockManager::LOCK_UW = 2 |
Definition at line 41 of file LockManager.php.
Referenced by SwiftFileBackend\addMissingMetadata(), FileBackendStore\concatenate(), FileBackendMultiWrite\doOperationsInternal(), and FileBackendStore\doOperationsInternal().