MediaWiki REL1_27
LBFactorySimple Class Reference

A simple single-master LBFactory that gets its configuration from the b/c globals. More...

Inheritance diagram for LBFactorySimple:
Collaboration diagram for LBFactorySimple:

Public Member Functions

 __construct (array $conf)
 Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
 
 forEachLB ( $callback, array $params=[])
 Execute a function for each tracked load balancer The callback is called with the load balancer as the first parameter, and $params passed as the subsequent parameters.
 
getExternalLB ( $cluster, $wiki=false)
 
 getMainLB ( $wiki=false)
 
 newMainLB ( $wiki=false)
 
 shutdown ( $flags=0)
 Prepare all tracked load balancers for shutdown.
 
- Public Member Functions inherited from LBFactory
 commitAll ( $fname=__METHOD__)
 Commit on all connections.
 
 commitMasterChanges ( $fname=__METHOD__, array $options=[])
 Commit changes on all master connections.
 
 disableChronologyProtection ()
 Disable the ChronologyProtector for all load balancers.
 
 hasMasterChanges ()
 Determine if any master connection has pending changes.
 
 hasOrMadeRecentMasterChanges ()
 Determine if any master connection has pending/written changes from this request.
 
 laggedSlaveUsed ()
 Detemine if any lagged slave connection was used.
 
 rollbackMasterChanges ( $fname=__METHOD__)
 Rollback changes on all master connections.
 
 waitForReplication (array $opts=[])
 Waits for the slave DBs to catch up to the current master position.
 

Protected Member Functions

 newExternalLB ( $cluster, $wiki=false)
 
- Protected Member Functions inherited from LBFactory
 newChronologyProtector ()
 
 shutdownChronologyProtector (ChronologyProtector $cp)
 

Private Attributes

LoadBalancer[] $extLBs = []
 
string $loadMonitorClass
 
LoadBalancer $mainLB
 

Additional Inherited Members

- Static Public Member Functions inherited from LBFactory
static destroyInstance ()
 Shut down, close connections and destroy the cached instance.
 
static disableBackend ()
 Disables all access to the load balancer, will cause all database access to throw a DBAccessError.
 
static getLBFactoryClass (array $config)
 Returns the LBFactory class to use and the load balancer configuration.
 
static setInstance ( $instance)
 Set the instance to be the given object.
 
static singleton ()
 Get an LBFactory instance.
 
- Public Attributes inherited from LBFactory
const SHUTDOWN_NO_CHRONPROT = 1
 
- Protected Attributes inherited from LBFactory
ChronologyProtector $chronProt
 
LoggerInterface $logger
 
string bool $readOnlyReason = false
 Reason all LBs are read-only or false if not.
 
TransactionProfiler $trxProfiler
 

Detailed Description

A simple single-master LBFactory that gets its configuration from the b/c globals.

Definition at line 27 of file LBFactorySimple.php.

Constructor & Destructor Documentation

◆ __construct()

LBFactorySimple::__construct ( array  $conf)

Construct a factory based on a configuration array (typically from $wgLBFactoryConf)

Parameters
array$conf

Reimplemented from LBFactory.

Definition at line 36 of file LBFactorySimple.php.

Member Function Documentation

◆ forEachLB()

LBFactorySimple::forEachLB (   $callback,
array  $params = [] 
)

Execute a function for each tracked load balancer The callback is called with the load balancer as the first parameter, and $params passed as the subsequent parameters.

Parameters
callable$callback
array$params

Reimplemented from LBFactory.

Definition at line 152 of file LBFactorySimple.php.

References $params, and as.

◆ getExternalLB()

& LBFactorySimple::getExternalLB (   $cluster,
  $wiki = false 
)
Parameters
string$cluster
bool | string$wiki
Returns
array

Reimplemented from LBFactory.

Definition at line 134 of file LBFactorySimple.php.

References newExternalLB().

◆ getMainLB()

LBFactorySimple::getMainLB (   $wiki = false)
Parameters
bool | string$wiki
Returns
LoadBalancer

Reimplemented from LBFactory.

Definition at line 99 of file LBFactorySimple.php.

References $mainLB, and newMainLB().

◆ newExternalLB()

LBFactorySimple::newExternalLB (   $cluster,
  $wiki = false 
)
protected
Exceptions
MWException
Parameters
string$cluster
bool | string$wiki
Returns
LoadBalancer

Reimplemented from LBFactory.

Definition at line 115 of file LBFactorySimple.php.

References $wgExternalServers, and global.

Referenced by getExternalLB().

◆ newMainLB()

LBFactorySimple::newMainLB (   $wiki = false)
Parameters
bool | string$wiki
Returns
LoadBalancer

Reimplemented from LBFactory.

Definition at line 48 of file LBFactorySimple.php.

References $flags, $i, $wgDBcompress, $wgDBname, $wgDBpassword, $wgDBserver, $wgDBservers, $wgDBssl, $wgDBtype, $wgDBuser, $wgDebugDumpSql, as, DBO_COMPRESS, DBO_DEBUG, DBO_DEFAULT, DBO_SSL, global, and true.

Referenced by getMainLB().

◆ shutdown()

LBFactorySimple::shutdown (   $flags = 0)

Prepare all tracked load balancers for shutdown.

Parameters
integer$flagsSupports SHUTDOWN_* flags STUB

Reimplemented from LBFactory.

Definition at line 161 of file LBFactorySimple.php.

References $flags, LBFactory\commitMasterChanges(), and LBFactory\shutdownChronologyProtector().

Member Data Documentation

◆ $extLBs

LoadBalancer [] LBFactorySimple::$extLBs = []
private

Definition at line 31 of file LBFactorySimple.php.

◆ $loadMonitorClass

string LBFactorySimple::$loadMonitorClass
private

Definition at line 34 of file LBFactorySimple.php.

◆ $mainLB

LoadBalancer LBFactorySimple::$mainLB
private

Definition at line 29 of file LBFactorySimple.php.

Referenced by getMainLB().


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