22use InvalidArgumentException;
41 $conn = $params[
'connection'] ??
null;
43 throw new InvalidArgumentException(
"Missing 'connection' argument." );
48 parent::__construct( [
55 'trxProfiler' => $params[
'trxProfiler'] ??
null,
56 'srvCache' => $params[
'srvCache'] ??
null,
57 'wanCache' => $params[
'wanCache'] ??
null,
58 'localDomain' => $params[
'localDomain'] ?? $this->conn->getDomainID(),
59 'readOnlyReason' => $params[
'readOnlyReason'] ??
false,
60 'clusterName' => $params[
'clusterName'] ??
null,
63 if ( isset( $params[
'readOnlyReason'] ) ) {
64 $conn->
setLBInfo( $conn::LB_READ_ONLY_REASON, $params[
'readOnlyReason'] );
75 return new static( array_merge(
78 [
'connection' => $db ]
83 foreach ( $lbInfo as $k => $v ) {
84 $this->conn->setLBInfo( $k, $v );
102class_alias( LoadBalancerSingle::class,
'LoadBalancerSingle' );
Class to handle database/schema/prefix specifications for IDatabase.