Class Horde_Lock

Description

Located in /Lock/Lock.php (line 28)


	
			
Direct descendents
Class Description
 class Horde_Lock_sql The Horde_Lock_sql driver implements a storage backend for the Horde_Lock API
Variable Summary
 $_params $_params
Method Summary
 Horde_Lock Horde_Lock (array $params)
 mixed clearLock (string $lockid)
 Horde_Lock factory (mixed $driver, [array $params = null])
 mixed getLockInfo (string $lockid)
 mixed getLocks ([string $scope = null], [string $principal = null], [int $type = null])
 mixed resetLock (string $lockid, int $extend)
 mixed setLock (string $requestor, string $scope, string $principal, [int $lifetime = 1], [string $exclusive = HORDE_LOCK_TYPE_SHARED])
 Horde_Lock &singleton (string $driver, [array $params = null])
 string _uuidgen (void 0)
Variables
$_params $_params (line 34)

Local copy of driver parameters

Methods
Constructor Horde_Lock (line 43)

Horde_Lock constructor

  • return: Instance of Horde_Lock on success or PEAR_Error
Horde_Lock Horde_Lock (array $params)
  • array $params: Parameters for the specific Horde_Lock driver
clearLock (line 147)

Removes a lock given the lock ID.

NOTE: No security checks are done in the Horde_Lock API. It is expected that the calling application has done all necessary security checks before requesting a lock be cleared.

  • return: True on success; PEAR_Error on failure.
mixed clearLock (string $lockid)
  • string $lockid: The lock ID as generated by a previous call to setLock()

Redefined in descendants as:
factory (line 195)

Attempts to return a concrete Horde_Lock instance based on $driver.

  • return: The newly created concrete Lock instance, or a PEAR_Error object on error.
Horde_Lock factory (mixed $driver, [array $params = null])
  • mixed $driver: The type of concrete Horde_Lock subclass to return. This is based on the storage driver ($driver). The code is dynamically included. If $driver is an array, then we will look in $driver[0]/lib/Lock/ for the subclass implementation named $driver[1].php.
  • array $params: A hash containing any additional configuration or connection parameters a subclass might need.
getLockInfo (line 57)

Return an array of information about the requested lock.

  • return: Array of lock information on success; PEAR_Error on failure.
mixed getLockInfo (string $lockid)
  • string $lockid: Lock ID to look up

Redefined in descendants as:
getLocks (line 78)

Return a list of valid locks with the option to limit the results by principal, scope and/or type.

  • return: Array of locks with the ID as the key and the lock details as the value. If there are no current locks this will return an empty array. On failure a PEAR_Error object will be returned.
mixed getLocks ([string $scope = null], [string $principal = null], [int $type = null])
  • string $scope: The scope of the lock. Typically the name of the application requesting the lock or some other identifier used to group locks together.
  • string $principal: Principal for which to check for locks
  • int $type: Only return locks of the given type. Defaults to null, or all locks

Redefined in descendants as:
resetLock (line 92)

Extend the valid lifetime of a valid lock to now + $extend.

  • return: True on success; PEAR_Error on failure.
mixed resetLock (string $lockid, int $extend)
  • string $lockid: Lock ID to reset. Must be a valid, non-expired lock.
  • int $extend: Extend lock this many seconds from now.

Redefined in descendants as:
setLock (line 130)

Sets a lock on the requested principal and returns the generated lock ID.

NOTE: No security checks are done in the Horde_Lock API. It is expected that the calling application has done all necessary security checks before requesting a lock be granted.

  • return: A string lock ID on success; PEAR_Error on failure.
mixed setLock (string $requestor, string $scope, string $principal, [int $lifetime = 1], [string $exclusive = HORDE_LOCK_TYPE_SHARED])
  • string $requestor: User ID of the lock requestor.
  • string $scope: The scope of the lock. Typically the name of the application requesting the lock or some other identifier used to group locks together.
  • string $principal: A principal on which a lock should be granted. The format can be any string but is suggested to be in URI form.
  • int $lifetime: Time (in seconds) for which the lock will be considered valid.
  • string $exclusive: exclusive One of HORDE_LOCK_TYPE_SHARED or HORDE_LOCK_TYPE_EXCLUSIVE.
    • An exclusive lock will be enforced strictly and must be interpreted to mean that the resource can not be modified. Only one exclusive lock per principal is allowed.
    • A shared lock is one that notifies other potential lock requestors that the resource is in use. This lock can be overridden (cleared or replaced with a subsequent call to setLock()) by other users. Multiple users may request (and will be granted) a shared lock on a given principal. All locks will be considered valid until they are cleared or expire.

Redefined in descendants as:
singleton (line 255)

Attempts to return a reference to a concrete Horde_Lock instance based on $driver. It will only create a new instance if no Horde_Lock instance with the same parameters currently exists.

This should be used if multiple authentication sources (and, thus, multiple Horde_Lock instances) are required.

This method must be invoked as: $var = &Horde_Lock::singleton()

  • return: The concrete Horde_Lock reference or PEAR_Error on failure.
Horde_Lock &singleton (string $driver, [array $params = null])
  • string $driver: The type of concrete Horde_Lock subclass to return. This is based on the storage driver ($driver). The code is dynamically included.
  • array $params: A hash containing any additional configuration or connection parameters a subclass might need.
_uuidgen (line 160)

Generate a new Universally Unique Identifier for use as lock token

Borrowed from HTTP_WebDAV_Server::_new_uuid()

  • return: UUID string
string _uuidgen (void 0)
  • void 0

Documentation generated on Sun, 30 Jan 2011 05:19:19 +0000 by phpDocumentor 1.4.3