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

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)
 releaseAllLocks ()
 isServerUp ($lockSrv)
 recordKeyForPath ($path, $type)
- 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)

Protected Attributes

 $lockServers = []
 $session = ''
- Protected Attributes inherited from QuorumLockManager
 $srvsByBucket = []
 $degradedBuckets = []
- Protected Attributes inherited from LockManager
 $locksHeld = []

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 redis servers.

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

This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations.


Constructor & Destructor Documentation

RedisLockManager::__construct ( array  $config)

Construct a new instance from configuration.

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.
  • redisConfig : Configuration for RedisConnectionPool::__construct().
RedisLockManager::__destruct ( )

Make sure remaining locks get cleared for sanity

Member Function Documentation

RedisLockManager::recordKeyForPath (   $path,
string$typeOne of (EX,SH)

Member Data Documentation

Initial value:
= [
self::LOCK_SH => self::LOCK_SH

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