Make Status extend StatusValue and start FileBackend update
[lhc/web/wiklou.git] / includes / filebackend / lockmanager / QuorumLockManager.php
index a692012..0db9e81 100644 (file)
  */
 abstract class QuorumLockManager extends LockManager {
        /** @var array Map of bucket indexes to peer server lists */
-       protected $srvsByBucket = array(); // (bucket index => (lsrv1, lsrv2, ...))
+       protected $srvsByBucket = []; // (bucket index => (lsrv1, lsrv2, ...))
 
        /** @var array Map of degraded buckets */
-       protected $degradedBuckets = array(); // (buckey index => UNIX timestamp)
+       protected $degradedBuckets = []; // (buckey index => UNIX timestamp)
 
        final protected function doLock( array $paths, $type ) {
-               return $this->doLockByType( array( $type => $paths ) );
+               return $this->doLockByType( [ $type => $paths ] );
        }
 
        final protected function doUnlock( array $paths, $type ) {
-               return $this->doUnlockByType( array( $type => $paths ) );
+               return $this->doUnlockByType( [ $type => $paths ] );
        }
 
        protected function doLockByType( array $pathsByType ) {
                $status = Status::newGood();
 
-               $pathsToLock = array(); // (bucket => type => paths)
+               $pathsToLock = []; // (bucket => type => paths)
                // Get locks that need to be acquired (buckets => locks)...
                foreach ( $pathsByType as $type => $paths ) {
                        foreach ( $paths as $path ) {
@@ -59,7 +59,7 @@ abstract class QuorumLockManager extends LockManager {
                        }
                }
 
-               $lockedPaths = array(); // files locked in this attempt (type => paths)
+               $lockedPaths = []; // files locked in this attempt (type => paths)
                // Attempt to acquire these locks...
                foreach ( $pathsToLock as $bucket => $pathsToLockByType ) {
                        // Try to acquire the locks for this bucket
@@ -85,7 +85,7 @@ abstract class QuorumLockManager extends LockManager {
        protected function doUnlockByType( array $pathsByType ) {
                $status = Status::newGood();
 
-               $pathsToUnlock = array(); // (bucket => type => paths)
+               $pathsToUnlock = []; // (bucket => type => paths)
                foreach ( $pathsByType as $type => $paths ) {
                        foreach ( $paths as $path ) {
                                if ( !isset( $this->locksHeld[$path][$type] ) ) {
@@ -112,7 +112,7 @@ abstract class QuorumLockManager extends LockManager {
                }
                if ( !count( $this->locksHeld ) ) {
                        $status->merge( $this->releaseAllLocks() );
-                       $this->degradedBuckets = array(); // safe to retry the normal quorum
+                       $this->degradedBuckets = []; // safe to retry the normal quorum
                }
 
                return $status;
@@ -124,7 +124,7 @@ abstract class QuorumLockManager extends LockManager {
         *
         * @param int $bucket
         * @param array $pathsByType Map of LockManager::LOCK_* constants to lists of paths
-        * @return Status
+        * @return StatusValue
         */
        final protected function doLockingRequestBucket( $bucket, array $pathsByType ) {
                $status = Status::newGood();
@@ -166,7 +166,7 @@ abstract class QuorumLockManager extends LockManager {
         *
         * @param int $bucket
         * @param array $pathsByType Map of LockManager::LOCK_* constants to lists of paths
-        * @return Status
+        * @return StatusValue
         */
        final protected function doUnlockingRequestBucket( $bucket, array $pathsByType ) {
                $status = Status::newGood();
@@ -189,7 +189,7 @@ abstract class QuorumLockManager extends LockManager {
                                }
                        }
                }
-               // Set a bad status if the quorum was not met.
+               // Set a bad StatusValue if the quorum was not met.
                // Assumes the same "up" servers as during the acquire step.
                $status->setResult( $yesVotes >= $quorum );
 
@@ -222,7 +222,7 @@ abstract class QuorumLockManager extends LockManager {
         *
         * @param string $lockSrv
         * @param array $pathsByType Map of LockManager::LOCK_* constants to lists of paths
-        * @return Status
+        * @return StatusValue
         */
        abstract protected function getLocksOnServer( $lockSrv, array $pathsByType );
 
@@ -233,7 +233,7 @@ abstract class QuorumLockManager extends LockManager {
         *
         * @param string $lockSrv
         * @param array $pathsByType Map of LockManager::LOCK_* constants to lists of paths
-        * @return Status
+        * @return StatusValue
         */
        abstract protected function freeLocksOnServer( $lockSrv, array $pathsByType );
 
@@ -242,7 +242,7 @@ abstract class QuorumLockManager extends LockManager {
         *
         * Subclasses must effectively implement this or freeLocksOnServer().
         *
-        * @return Status
+        * @return StatusValue
         */
        abstract protected function releaseAllLocks();
 }