Merge "Add GetContentModels hook to allow extensions to enumerate dynamic content...
[lhc/web/wiklou.git] / includes / libs / rdbms / lbfactory / ILBFactory.php
index 9c9f18d..3e0800a 100644 (file)
  * @ingroup Database
  */
 
+namespace Wikimedia\Rdbms;
+
+use InvalidArgumentException;
+use ILoadBalancer;
+use LoadBalancer;
+use DBTransactionError;
+use DBReplicationWaitError;
+
 /**
  * An interface for generating database load balancers
  * @ingroup Database
@@ -86,28 +94,41 @@ interface ILBFactory {
 
        /**
         * Create a new load balancer for external storage. The resulting object will be
-        * untracked, not chronology-protected, and the caller is responsible for
-        * cleaning it up.
+        * untracked, not chronology-protected, and the caller is responsible for cleaning it up.
         *
         * This method is for only advanced usage and callers should almost always use
         * getExternalLB() instead. This method can be useful when a table is used as a
         * key/value store. In that cases, one might want to query it in autocommit mode
         * (DBO_TRX off) but still use DBO_TRX transaction rounds on other tables.
         *
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $domain Domain ID, or false for the current domain
+        * @param string $cluster External storage cluster name
         * @return ILoadBalancer
         */
-       public function newExternalLB( $cluster, $domain = false );
+       public function newExternalLB( $cluster );
 
        /**
         * Get a cached (tracked) load balancer for external storage
         *
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $domain Domain ID, or false for the current domain
+        * @param string $cluster External storage cluster name
         * @return ILoadBalancer
         */
-       public function getExternalLB( $cluster, $domain = false );
+       public function getExternalLB( $cluster );
+
+       /**
+        * Get cached (tracked) load balancers for all main database clusters
+        *
+        * @return LoadBalancer[] Map of (cluster name => LoadBalancer)
+        * @since 1.29
+        */
+       public function getAllMainLBs();
+
+       /**
+        * Get cached (tracked) load balancers for all external database clusters
+        *
+        * @return LoadBalancer[] Map of (cluster name => LoadBalancer)
+        * @since 1.29
+        */
+       public function getAllExternalLBs();
 
        /**
         * Execute a function for each tracked load balancer
@@ -165,7 +186,7 @@ interface ILBFactory {
         * @param string $fname Caller name
         * @param array $options Options map:
         *   - maxWriteDuration: abort if more than this much time was spent in write queries
-        * @throws Exception
+        * @throws DBTransactionError
         */
        public function commitMasterChanges( $fname = __METHOD__, array $options = [] );