Merge "Move Title::isNamespaceProtected() to PermissionManager."
[lhc/web/wiklou.git] / includes / libs / rdbms / loadbalancer / ILoadBalancer.php
index 4a4e1bc..160d501 100644 (file)
@@ -86,8 +86,8 @@ interface ILoadBalancer {
 
        /** @var string Domain specifier when no specific database needs to be selected */
        const DOMAIN_ANY = '';
-       /** @var bool The generic query group (bool gives b/c with 1.33 method signatures) */
-       const GROUP_GENERIC = false;
+       /** @var string The generic query group */
+       const GROUP_GENERIC = '';
 
        /** @var int DB handle should have DBO_TRX disabled and the caller will leave it as such */
        const CONN_TRX_AUTOCOMMIT = 1;
@@ -95,6 +95,8 @@ interface ILoadBalancer {
        const CONN_SILENCE_ERRORS = 2;
        /** @var int Caller is requesting the master DB server for possibly writes */
        const CONN_INTENT_WRITABLE = 4;
+       /** @var int Bypass and update any server-side read-only mode state cache */
+       const CONN_REFRESH_READ_ONLY = 8;
 
        /** @var string Manager of ILoadBalancer instances is running post-commit callbacks */
        const STAGE_POSTCOMMIT_CALLBACKS = 'stage-postcommit-callbacks';
@@ -155,6 +157,18 @@ interface ILoadBalancer {
         */
        public function redefineLocalDomain( $domain );
 
+       /**
+        * Indicate whether the tables on this domain are only temporary tables for testing
+        *
+        * In "temporary tables mode", the ILoadBalancer::CONN_TRX_AUTOCOMMIT flag is ignored
+        *
+        * @param bool $value
+        * @param string $domain
+        * @return bool Whether "temporary tables mode" was active
+        * @since 1.34
+        */
+       public function setTempTablesOnlyMode( $value, $domain );
+
        /**
         * Get the server index of the reader connection for a given group
         *
@@ -167,8 +181,7 @@ interface ILoadBalancer {
         *
         * @param string|bool $group Query group or false for the generic group
         * @param string|bool $domain DB domain ID or false for the local domain
-        * @throws DBError If no live handle can be obtained
-        * @return bool|int|string
+        * @return int|bool Returns false if no live handle can be obtained
         */
        public function getReaderIndex( $group = false, $domain = false );
 
@@ -270,7 +283,7 @@ interface ILoadBalancer {
         * @see ILoadBalancer::getServerAttributes()
         *
         * @param int $i Server index (overrides $groups) or DB_MASTER/DB_REPLICA
-        * @param string[]|string $groups Query group(s) or [] to use the default group
+        * @param string[]|string $groups Query group(s) in preference order; [] for the default group
         * @param string|bool $domain DB domain ID or false for the local domain
         * @param int $flags Bitfield of CONN_* class constants
         *
@@ -326,7 +339,7 @@ interface ILoadBalancer {
         * @see ILoadBalancer::getConnection() for parameter information
         *
         * @param int $i Server index or DB_MASTER/DB_REPLICA
-        * @param string[]|string $groups Query group(s) or [] to use the default group
+        * @param string[]|string $groups Query group(s) in preference order; [] for the default group
         * @param string|bool $domain DB domain ID or false for the local domain
         * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
         * @return DBConnRef
@@ -347,7 +360,7 @@ interface ILoadBalancer {
         * @see ILoadBalancer::getConnection() for parameter information
         *
         * @param int $i Server index or DB_MASTER/DB_REPLICA
-        * @param string[]|string $groups Query group(s) or [] to use the default group
+        * @param string[]|string $groups Query group(s) in preference order; [] for the default group
         * @param string|bool $domain DB domain ID or false for the local domain
         * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
         * @return DBConnRef
@@ -369,7 +382,7 @@ interface ILoadBalancer {
         * @see ILoadBalancer::getConnection() for parameter information
         *
         * @param int $i Server index or DB_MASTER/DB_REPLICA
-        * @param string[]|string $groups Query group(s) or [] to use the default group
+        * @param string[]|string $groups Query group(s) in preference order; [] for the default group
         * @param string|bool $domain DB domain ID or false for the local domain
         * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
         * @return MaintainableDBConnRef
@@ -650,10 +663,9 @@ interface ILoadBalancer {
        /**
         * @note This method may trigger a DB connection if not yet done
         * @param string|bool $domain DB domain ID or false for the local domain
-        * @param IDatabase|null $conn DB master connection; used to avoid loops [optional]
         * @return string|bool Reason the master is read-only or false if it is not
         */
-       public function getReadOnlyReason( $domain = false, IDatabase $conn = null );
+       public function getReadOnlyReason( $domain = false );
 
        /**
         * Disables/enables lag checks