MediaWiki  1.23.1
LoadBalancerSingle Class Reference

Helper class for LBFactorySingle. More...

Inheritance diagram for LoadBalancerSingle:
Collaboration diagram for LoadBalancerSingle:

Public Member Functions

 __construct ( $params)
 
 reallyOpenConnection ( $server, $dbNameOverride=false)
 
- Public Member Functions inherited from LoadBalancer
 allowLagged ( $mode=null)
 Disables/enables lag checks. More...
 
 clearLagTimeCache ()
 Clear the cache for getLagTimes. More...
 
 closeAll ()
 Close all open connections. More...
 
 closeConnection ( $conn)
 Close a connection Using this function makes sure the LoadBalancer knows the connection is closed. More...
 
 closeConnecton ( $conn)
 Deprecated function, typo in function name. More...
 
 commitAll ()
 Commit transactions on all open connections. More...
 
 commitMasterChanges ()
 Issue COMMIT only on master, only if queries were done on connection. More...
 
 forEachOpenConnection ( $callback, $params=array())
 Call a function with each open connection object. More...
 
 getAnyOpenConnection ( $i)
 Get any open connection to a given server index, local or foreign Returns false if there is no connection open. More...
 
getConnection ( $i, $groups=array(), $wiki=false)
 Get a connection by index This is the main entry point for this class. More...
 
 getConnectionRef ( $db, $groups=array(), $wiki=false)
 Get a database connection handle reference. More...
 
 getLaggedSlaveMode ()
 
 getLagTimes ( $wiki=false)
 Get lag time for each server Results are cached for a short time in memcached, and indefinitely in the process cache. More...
 
 getLazyConnectionRef ( $db, $groups=array(), $wiki=false)
 Get a database connection handle reference without connecting yet. More...
 
 getLoadMonitor ()
 Get a LoadMonitor instance. More...
 
 getMasterPos ()
 Get the current master position for chronology control purposes. More...
 
 getMaxLag ( $wiki=false)
 Get the hostname and lag time of the most-lagged slave. More...
 
 getRandomNonLagged ( $loads, $wiki=false)
 
 getReaderIndex ( $group=false, $wiki=false)
 Get the index of the reader connection, which may be a slave This takes into account load ratios and lag times. More...
 
 getServerCount ()
 Get the number of defined servers (not the number of open connections) More...
 
 getServerInfo ( $i)
 Return the server info structure for a given index, or false if the index is invalid. More...
 
 getServerName ( $i)
 Get the host name or IP address of the server with the specified index Prefer a readable name if available. More...
 
 getWriterIndex ()
 
 hasMasterChanges ()
 Determine if there are any pending changes that need to be rolled back or committed. More...
 
 haveIndex ( $i)
 Returns true if the specified index is a valid server index. More...
 
 isNonZeroLoad ( $i)
 Returns true if the specified index is valid and has non-zero load. More...
 
 isOpen ( $index)
 Test if the specified index represents an open connection. More...
 
 openConnection ( $i, $wiki=false)
 Open a connection to the server given by the specified index Index must be an actual index into the array. More...
 
 openForeignConnection ( $i, $wiki)
 Open a connection to a foreign DB, or return one if it is already open. More...
 
 parentInfo ( $x=null)
 Get or set arbitrary data used by the parent object, usually an LBFactory. More...
 
 pickRandom ( $weights)
 Given an array of non-normalised probabilities, this function will select an element and return the appropriate key. More...
 
 pingAll ()
 
 reuseConnection ( $conn)
 Mark a foreign connection as being available for reuse under a different DB name or prefix. More...
 
 rollbackMasterChanges ()
 Issue ROLLBACK only on master, only if queries were done on connection. More...
 
 safeGetLag ( $conn)
 Get the lag in seconds for a given connection, or zero if this load balancer does not have replication enabled. More...
 
 setServerInfo ( $i, $serverInfo)
 Sets the server info structure for the given index. More...
 
 sleep ( $t)
 Wait for a specified number of microseconds, and return the period waited. More...
 
 waitFor ( $pos)
 Set the master wait position If a DB_SLAVE connection has been opened already, waits Otherwise sets a variable telling it to wait if such a connection is opened. More...
 
 waitForAll ( $pos)
 Set the master wait position and wait for ALL slaves to catch up to it. More...
 
 waitTimeout ( $value=null)
 

Protected Attributes

DatabaseBase $db
 

Additional Inherited Members

- Public Attributes inherited from LoadBalancer
 $mAllowLagged
 
 $mConns
 
 $mGroupLoads
 
 $mLagTimes
 
 $mLastError = 'Unknown error'
 
 $mLoadMonitor
 
 $mLoads
 
- Protected Member Functions inherited from LoadBalancer
 doWait ( $index, $open=false)
 Wait for a given slave to catch up to the master pos stored in $this. More...
 

Detailed Description

Helper class for LBFactorySingle.

Definition at line 84 of file LBFactorySingle.php.

Constructor & Destructor Documentation

◆ __construct()

LoadBalancerSingle::__construct (   $params)
Parameters
$paramsarray

Reimplemented from LoadBalancer.

Definition at line 90 of file LBFactorySingle.php.

References $params, and array().

Member Function Documentation

◆ reallyOpenConnection()

LoadBalancerSingle::reallyOpenConnection (   $server,
  $dbNameOverride = false 
)
Parameters
string$server
bool$dbNameOverride
Returns
DatabaseBase

Reimplemented from LoadBalancer.

Definition at line 107 of file LBFactorySingle.php.

References $db.

Member Data Documentation

◆ $db

DatabaseBase LoadBalancerSingle::$db
protected

Definition at line 85 of file LBFactorySingle.php.

Referenced by reallyOpenConnection().


The documentation for this class was generated from the following file: