* @ingroup Database
*/
+namespace Wikimedia\Rdbms;
+
+use InvalidArgumentException;
+
/**
* A simple single-master LBFactory that gets its configuration from the b/c globals
*/
return $this->mainLB;
}
- /**
- * @param string $cluster
- * @param bool|string $domain
- * @return LoadBalancer
- * @throws InvalidArgumentException
- */
- public function newExternalLB( $cluster, $domain = false ) {
+ public function newExternalLB( $cluster ) {
if ( !isset( $this->externalClusters[$cluster] ) ) {
throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"." );
}
return $this->newLoadBalancer( $this->externalClusters[$cluster] );
}
- /**
- * @param string $cluster
- * @param bool|string $domain
- * @return LoadBalancer
- */
- public function getExternalLB( $cluster, $domain = false ) {
+ public function getExternalLB( $cluster ) {
if ( !isset( $this->extLBs[$cluster] ) ) {
- $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $domain );
+ $this->extLBs[$cluster] = $this->newExternalLB( $cluster );
$this->getChronologyProtector()->initLB( $this->extLBs[$cluster] );
}
return $this->extLBs[$cluster];
}
+ public function getAllMainLBs() {
+ return [ 'DEFAULT' => $this->getMainLB() ];
+ }
+
+ public function getAllExternalLBs() {
+ $lbs = [];
+ foreach ( $this->externalClusters as $cluster => $unused ) {
+ $lbs[$cluster] = $this->getExternalLB( $cluster );
+ }
+
+ return $lbs;
+ }
+
private function newLoadBalancer( array $servers ) {
$lb = new LoadBalancer( array_merge(
$this->baseLoadBalancerParams(),