BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
MemcLockManager Class Reference
Inheritance diagram for MemcLockManager:
Collaboration diagram for MemcLockManager:

Public Member Functions

 __construct (array $config)
 
 __destruct ()
 
- Public Member Functions inherited from LockManager
 __construct (array $config)
 
 lock (array $paths, $type=self::LOCK_EX, $timeout=0)
 
 lockByType (array $pathsByType, $timeout=0)
 
 unlock (array $paths, $type=self::LOCK_EX)
 
 unlockByType (array $pathsByType)
 

Protected Member Functions

 getLocksOnServer ($lockSrv, array $pathsByType)
 
 freeLocksOnServer ($lockSrv, array $pathsByType)
 
 doGetLocksOnServer ($lockSrv, array $paths, $type)
 
 doFreeLocksOnServer ($lockSrv, array $paths, $type)
 
 releaseAllLocks ()
 
 isServerUp ($lockSrv)
 
 getCache ($lockSrv)
 
 recordKeyForPath ($path)
 
 acquireMutexes (MemcachedBagOStuff $memc, array $keys)
 
 releaseMutexes (MemcachedBagOStuff $memc, array $keys)
 
- Protected Member Functions inherited from QuorumLockManager
 doLock (array $paths, $type)
 
 doUnlock (array $paths, $type)
 
 doLockByType (array $pathsByType)
 
 doUnlockByType (array $pathsByType)
 
 doLockingRequestBucket ($bucket, array $pathsByType)
 
 doUnlockingRequestBucket ($bucket, array $pathsByType)
 
 getBucketFromPath ($path)
 
 isServerUp ($lockSrv)
 
 getLocksOnServer ($lockSrv, array $pathsByType)
 
 freeLocksOnServer ($lockSrv, array $pathsByType)
 
 releaseAllLocks ()
 
- Protected Member Functions inherited from LockManager
 sha1Base36Absolute ($path)
 
 sha1Base16Absolute ($path)
 
 normalizePathsByType (array $pathsByType)
 
 doLockByType (array $pathsByType)
 
 doLock (array $paths, $type)
 
 doUnlockByType (array $pathsByType)
 
 doUnlock (array $paths, $type)
 

Static Protected Member Functions

static newLockArray ()
 
static sanitizeLockArray ($a)
 

Protected Attributes

 $lockTypeMap
 
 $bagOStuffs = []
 
 $serversUp = []
 
 $session = ''
 
- Protected Attributes inherited from QuorumLockManager
 $srvsByBucket = []
 
 $degradedBuckets = []
 
- Protected Attributes inherited from LockManager
 $lockTypeMap
 
 $locksHeld = []
 
 $domain
 
 $lockTTL
 

Additional Inherited Members

- Public Attributes inherited from LockManager
const LOCK_SH = 1
 
const LOCK_UW = 2
 
const LOCK_EX = 3
 

Detailed Description

Manage locks using memcached servers.

Version of LockManager based on using memcached 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 memcached. A majority of peers must agree for a lock to be acquired.

Since
1.20

Constructor & Destructor Documentation

MemcLockManager::__construct ( array  $config)

Construct a new instance from configuration.

Parameters
array$configParameters include:
  • lockServers : Associative array of server names to "<IP>:<port>" strings.
  • srvsByBucket : Array of 1-16 consecutive integer keys, starting from 0, each having an odd-numbered list of server names (peers) as values.
  • memcConfig : Configuration array for ObjectCache::newFromParams. [optional] If set, this must use one of the memcached classes.
Exceptions
Exception
MemcLockManager::__destruct ( )

Make sure remaining locks get cleared for sanity

Member Function Documentation

MemcLockManager::acquireMutexes ( MemcachedBagOStuff  $memc,
array  $keys 
)
protected
Parameters
MemcachedBagOStuff$memc
array$keysList of keys to acquire
Returns
bool
MemcLockManager::doFreeLocksOnServer (   $lockSrv,
array  $paths,
  $type 
)
protected
See Also
QuorumLockManager::freeLocksOnServer()
Parameters
string$lockSrv
array$paths
string$type
Returns
Status
MemcLockManager::doGetLocksOnServer (   $lockSrv,
array  $paths,
  $type 
)
protected
See Also
QuorumLockManager::getLocksOnServer()
Parameters
string$lockSrv
array$paths
string$type
Returns
Status
MemcLockManager::getCache (   $lockSrv)
protected

Get the MemcachedBagOStuff object for a $lockSrv

Parameters
string$lockSrvServer name
Returns
MemcachedBagOStuff|null
MemcLockManager::isServerUp (   $lockSrv)
protected
See Also
QuorumLockManager::isServerUp()
Parameters
string$lockSrv
Returns
bool
static MemcLockManager::newLockArray ( )
staticprotected
Returns
array An empty lock structure for a key
MemcLockManager::recordKeyForPath (   $path)
protected
Parameters
string$path
Returns
string
MemcLockManager::releaseAllLocks ( )
protected
MemcLockManager::releaseMutexes ( MemcachedBagOStuff  $memc,
array  $keys 
)
protected
Parameters
MemcachedBagOStuff$memc
array$keysList of acquired keys
static MemcLockManager::sanitizeLockArray (   $a)
staticprotected
Parameters
array$a
Returns
array An empty lock structure for a key

Member Data Documentation

MemcLockManager::$lockTypeMap
protected
Initial value:
= [
self::LOCK_SH => self::LOCK_SH

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