MediaWiki  REL1_22
FSLockManager Class Reference

Simple version of LockManager based on using FS lock files. More...

Inheritance diagram for FSLockManager:
Collaboration diagram for FSLockManager:

List of all members.

Public Member Functions

 __construct (array $config)
 Construct a new instance from configuration.
 __destruct ()
 Make sure remaining locks get cleared for sanity.

Protected Member Functions

 doLock (array $paths, $type)
 doSingleLock ($path, $type)
 Lock a single resource key.
 doSingleUnlock ($path, $type)
 Unlock a single resource key.
 doUnlock (array $paths, $type)
 getLockPath ($path)
 Get the path to the lock file for a key.

Protected Attributes

Array $handles = array()
 Map of (locked key => lock file handle) *.
 $lockDir
Array $lockTypeMap
 Mapping of lock types to the type actually used *.

Private Member Functions

 closeLockHandles ($path, array $handlesToClose)
 pruneKeyLockFiles ($path)

Detailed Description

Simple version of LockManager based on using FS lock files.

All locks are non-blocking, which avoids deadlocks.

This should work fine for small sites running off one server. Do not use this with 'lockDirectory' set to an NFS mount unless the NFS client is at least version 2.6.12. Otherwise, the BSD flock() locks will be ignored; see http://nfs.sourceforge.net/#section_d.

Since:
1.19

Definition at line 36 of file FSLockManager.php.


Constructor & Destructor Documentation

Construct a new instance from configuration.

$config includes:

  • lockDirectory : Directory containing the lock files
Parameters:
array$config

Reimplemented from LockManager.

Definition at line 55 of file FSLockManager.php.

Make sure remaining locks get cleared for sanity.

Definition at line 237 of file FSLockManager.php.


Member Function Documentation

FSLockManager::closeLockHandles ( path,
array handlesToClose 
) [private]
Parameters:
$pathstring
$handlesToClosearray
Returns:
Status

Definition at line 196 of file FSLockManager.php.

FSLockManager::doLock ( array paths,
type 
) [protected]
See also:
LockManager::doLock()
Parameters:
$pathsarray
$typeint
Returns:
Status

Reimplemented from LockManager.

Definition at line 67 of file FSLockManager.php.

FSLockManager::doSingleLock ( path,
type 
) [protected]

Lock a single resource key.

Parameters:
$pathstring
$typeinteger
Returns:
Status

Definition at line 108 of file FSLockManager.php.

FSLockManager::doSingleUnlock ( path,
type 
) [protected]

Unlock a single resource key.

Parameters:
$pathstring
$typeinteger
Returns:
Status

Definition at line 153 of file FSLockManager.php.

FSLockManager::doUnlock ( array paths,
type 
) [protected]
See also:
LockManager::doUnlock()
Parameters:
$pathsarray
$typeint
Returns:
Status

Reimplemented from LockManager.

Definition at line 91 of file FSLockManager.php.

FSLockManager::getLockPath ( path) [protected]

Get the path to the lock file for a key.

Parameters:
$pathstring
Returns:
string

Definition at line 230 of file FSLockManager.php.

FSLockManager::pruneKeyLockFiles ( path) [private]
Parameters:
$pathstring
Returns:
Status

Definition at line 213 of file FSLockManager.php.


Member Data Documentation

Array FSLockManager::$handles = array() [protected]

Map of (locked key => lock file handle) *.

Definition at line 45 of file FSLockManager.php.

FSLockManager::$lockDir [protected]

Definition at line 43 of file FSLockManager.php.

Array FSLockManager::$lockTypeMap [protected]
Initial value:
 array(
        self::LOCK_SH => self::LOCK_SH,
        self::LOCK_UW => self::LOCK_SH,
        self::LOCK_EX => self::LOCK_EX
    )

Mapping of lock types to the type actually used *.

Reimplemented from LockManager.

Definition at line 37 of file FSLockManager.php.


The documentation for this class was generated from the following file: