LockHandler.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
12 
15 
16 /**
17  * LockHandler defines the interface for LockHandler implementations.
18  *
19  * @author ingo herwig <ingo@wemove.com>
20  */
21 interface LockHandler {
22 
23  /**
24  * Aquire a lock on an object id for the current user and throw
25  * an exception, if another user already owns a pessimistic lock on
26  * the object.
27  * @param $oid ObjectId of the object to lock.
28  * @param $type One of the Lock::Type constants.
29  * @param $currentState PersistentObject instance defining the current state
30  * for an optimistic lock (optional, only given if type is Lock::TYPE_OPTIMISTIC)
31  */
32  public function aquireLock(ObjectId $oid, $type, PersistentObject $currentState=null);
33 
34  /**
35  * Release the lock the current user owns on an object id.
36  * @param $oid ObjectId of the object to release.
37  * @param $type One of the Lock::Type constants or null for all types (default: _null_)
38  */
39  public function releaseLock(ObjectId $oid, $type=null);
40 
41  /**
42  * Release all locks on an object id regardless of the user.
43  * @param $oid ObjectId of the object to release.
44  */
45  public function releaseLocks(ObjectId $oid);
46 
47  /**
48  * Release all locks owned by the current user.
49  */
50  public function releaseAllLocks();
51 
52  /**
53  * Get the lock for an object id.
54  * @param $oid object id of the object to get the lock data for.
55  * @return Lock instance or null
56  */
57  public function getLock(ObjectId $oid);
58 
59  /**
60  * Update the current state of the lock belonging to the given object
61  * if existing and owned by the current.
62  * @param $oid The object id.
63  * @param $object The updated object data.
64  */
65  public function updateLock(ObjectId $oid, PersistentObject $object);
66 }
67 ?>
updateLock(ObjectId $oid, PersistentObject $object)
Update the current state of the lock belonging to the given object if existing and owned by the curre...
getLock(ObjectId $oid)
Get the lock for an object id.
ObjectId is the unique identifier of an object.
Definition: ObjectId.php:28
LockHandler defines the interface for LockHandler implementations.
Definition: LockHandler.php:21
aquireLock(ObjectId $oid, $type, PersistentObject $currentState=null)
Aquire a lock on an object id for the current user and throw an exception, if another user already ow...
releaseLock(ObjectId $oid, $type=null)
Release the lock the current user owns on an object id.
PersistentObject defines the interface of all persistent objects.
releaseAllLocks()
Release all locks owned by the current user.
releaseLocks(ObjectId $oid)
Release all locks on an object id regardless of the user.