MediaWiki  REL1_22
LSLockManager Class Reference

Manage locks using a lock daemon server. More...

Inheritance diagram for LSLockManager:
Collaboration diagram for LSLockManager:

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

 freeLocksOnServer ($lockSrv, array $paths, $type)
 getConnection ($lockSrv)
 Get (or reuse) a connection to a lock server.
 getLocksOnServer ($lockSrv, array $paths, $type)
 isServerUp ($lockSrv)
 releaseAllLocks ()
 sendCommand ($lockSrv, $action, $type, $values)
 Send a command and get back the response.

Protected Attributes

Array $conns = array()
 Map Server connections (server name => resource) *.
 $connTimeout
Array $lockServers
 Map of server names to server config *.
Array $lockTypeMap
 Mapping of lock types to the type actually used *.
 $session = ''

Detailed Description

Manage locks using a lock daemon server.

Version of LockManager based on using lock daemon servers. This is meant for multi-wiki systems that may share files. All locks are non-blocking, which avoids deadlocks.

All lock requests for a resource, identified by a hash string, will map to one bucket. Each bucket maps to one or several peer servers, each running LockServerDaemon.php, listening on a designated TCP port. A majority of peers must agree for a lock to be acquired.

Since:
1.19

Definition at line 39 of file LSLockManager.php.


Constructor & Destructor Documentation

Construct a new instance from configuration.

$config paramaters include:

  • lockServers : Associative array of server names to configuration. Configuration is an associative array that includes:
    • host : IP address/hostname
    • port : TCP port
    • authKey : Secret string the lock server uses
  • srvsByBucket : Array of 1-16 consecutive integer keys, starting from 0, each having an odd-numbered list of server names (peers) as values.
  • connTimeout : Lock server connection attempt timeout. [optional]
Parameters:
array$config

Reimplemented from LockManager.

Definition at line 68 of file LSLockManager.php.

Make sure remaining locks get cleared for sanity.

Definition at line 209 of file LSLockManager.php.


Member Function Documentation

LSLockManager::freeLocksOnServer ( lockSrv,
array paths,
type 
) [protected]
See also:
QuorumLockManager::freeLocksOnServer()
Returns:
Status

Definition at line 110 of file LSLockManager.php.

LSLockManager::getConnection ( lockSrv) [protected]

Get (or reuse) a connection to a lock server.

Parameters:
$lockSrvstring
Returns:
resource

Definition at line 188 of file LSLockManager.php.

LSLockManager::getLocksOnServer ( lockSrv,
array paths,
type 
) [protected]
See also:
QuorumLockManager::getLocksOnServer()
Returns:
Status

Definition at line 89 of file LSLockManager.php.

LSLockManager::isServerUp ( lockSrv) [protected]
See also:
QuorumLockManager::isServerUp()
Returns:
bool

Reimplemented from QuorumLockManager.

Definition at line 148 of file LSLockManager.php.

See also:
QuorumLockManager::releaseAllLocks()
Returns:
Status

Reimplemented from QuorumLockManager.

Definition at line 131 of file LSLockManager.php.

LSLockManager::sendCommand ( lockSrv,
action,
type,
values 
) [protected]

Send a command and get back the response.

Parameters:
$lockSrvstring
$actionstring
$typestring
$valuesArray
Returns:
string|bool

Definition at line 161 of file LSLockManager.php.


Member Data Documentation

Array LSLockManager::$conns = array() [protected]

Map Server connections (server name => resource) *.

Definition at line 48 of file LSLockManager.php.

LSLockManager::$connTimeout [protected]

Definition at line 50 of file LSLockManager.php.

Array LSLockManager::$lockServers [protected]

Map of server names to server config *.

Definition at line 46 of file LSLockManager.php.

Array LSLockManager::$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 40 of file LSLockManager.php.

LSLockManager::$session = '' [protected]

Definition at line 51 of file LSLockManager.php.


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