MediaWiki  REL1_24
LBFactoryMulti Class Reference

A multi-wiki, multi-master factory for Wikimedia and similar installations. More...

Inheritance diagram for LBFactoryMulti:
Collaboration diagram for LBFactoryMulti:

List of all members.

Public Member Functions

 __construct ($conf)
 forEachLB ($callback, $params=array())
 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.
 getDBNameAndPrefix ($wiki=false)
 Get the database name and prefix based on the wiki ID.
getExternalLB ($cluster, $wiki=false)
 getMainLB ($wiki=false)
 getSectionForWiki ($wiki=false)
 makeServerArray ($template, $loads, $groupLoads)
 Make a server array as expected by LoadBalancer::__construct, using a template and load array.
 newExternalLB ($cluster, $wiki=false)
 newLoadBalancer ($template, $loads, $groupLoads)
 Make a new load balancer object based on template and load array.
 newMainLB ($wiki=false)
 reindexGroupLoads ($groupLoads)
 Take a group load array indexed by group then server, and reindex it by server then group.
 shutdown ()
 Prepare all tracked load balancers for shutdown STUB.

Protected Attributes

array $conf
 Load balancer factory configuration *.
array $externalLoads = array()
 A map of external storage cluster name to server load map *.
array $externalTemplateOverrides
 A set of server info keys overriding serverTemplate for external storage.
LoadBalancer[] $extLBs = array()
 *
array $groupLoadsByDB = array()
 A 3-d map giving server load ratios by DB name *.
array $groupLoadsBySection = array()
 A 3-d map giving server load ratios for each section and group *.
array $hostsByName = array()
 A map of hostname to IP address *.
string $lastSection
 *
string $lastWiki
 *
LoadBalancer[] $mainLBs = array()
 *
array $masterTemplateOverrides
 An override array for all master servers *.
 $readOnlyBySection = array()
array $sectionLoads
 A 2-d map.
array $sectionsByDB
 A map of database names to section names *.
array $serverTemplate
 A server info associative array as documented for $wgDBservers.
array $templateOverridesByCluster
 A 2-d map overriding the server info by external storage cluster *.
array $templateOverridesByServer
 A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis.

Detailed Description

A multi-wiki, multi-master factory for Wikimedia and similar installations.

Ignores the old configuration globals

Configuration: sectionsByDB A map of database names to section names.

sectionLoads A 2-d map. For each section, gives a map of server names to load ratios. For example: array( 'section1' => array( 'db1' => 100, 'db2' => 100 ) )

serverTemplate A server info associative array as documented for $wgDBservers. The host, hostName and load entries will be overridden.

groupLoadsBySection A 3-d map giving server load ratios for each section and group. For example: array( 'section1' => array( 'group1' => array( 'db1' => 100, 'db2' => 100 ) ) )

groupLoadsByDB A 3-d map giving server load ratios by DB name.

hostsByName A map of hostname to IP address.

externalLoads A map of external storage cluster name to server load map.

externalTemplateOverrides A set of server info keys overriding serverTemplate for external storage.

templateOverridesByServer A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis. Applies to both core and external storage.

templateOverridesByCluster A 2-d map overriding the server info by external storage cluster.

masterTemplateOverrides An override array for all master servers.

readOnlyBySection A map of section name to read-only message. Missing or false for read/write.

Definition at line 76 of file LBFactoryMulti.php.


Constructor & Destructor Documentation

Parameters:
array$conf
Exceptions:
MWException

Reimplemented from LBFactory.

Definition at line 139 of file LBFactoryMulti.php.


Member Function Documentation

LBFactoryMulti::forEachLB ( callback,
params = array() 
)

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 364 of file LBFactoryMulti.php.

References $wgDBname, array(), and global.

Get the database name and prefix based on the wiki ID.

Parameters:
bool | string$wiki
Returns:
array

Definition at line 347 of file LBFactoryMulti.php.

References array(), and as.

& LBFactoryMulti::getExternalLB ( cluster,
wiki = false 
)
Parameters:
string$clusterExternal storage cluster, or false for core
bool | string$wikiWiki ID, or false for the current wiki
Returns:
LoadBalancer

Reimplemented from LBFactory.

Definition at line 254 of file LBFactoryMulti.php.

Parameters:
bool | string$wiki
Returns:
LoadBalancer

Reimplemented from LBFactory.

Definition at line 216 of file LBFactoryMulti.php.

Parameters:
bool | string$wiki
Returns:
string

Definition at line 173 of file LBFactoryMulti.php.

LBFactoryMulti::makeServerArray ( template,
loads,
groupLoads 
)

Make a server array as expected by LoadBalancer::__construct, using a template and load array.

Parameters:
array$template
array$loads
array$groupLoads
Returns:
array

Definition at line 289 of file LBFactoryMulti.php.

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

Reimplemented from LBFactory.

Definition at line 234 of file LBFactoryMulti.php.

References $lb, $section, array(), and newMainLB().

LBFactoryMulti::newLoadBalancer ( template,
loads,
groupLoads 
)

Make a new load balancer object based on template and load array.

Parameters:
array$template
array$loads
array$groupLoads
Returns:
LoadBalancer

Definition at line 272 of file LBFactoryMulti.php.

Parameters:
bool | string$wiki
Returns:
LoadBalancer

Reimplemented from LBFactory.

Definition at line 193 of file LBFactoryMulti.php.

Referenced by newExternalLB().

Take a group load array indexed by group then server, and reindex it by server then group.

Parameters:
array$groupLoads
Returns:
array

Definition at line 331 of file LBFactoryMulti.php.

Prepare all tracked load balancers for shutdown STUB.

Reimplemented from LBFactory.

Definition at line 373 of file LBFactoryMulti.php.


Member Data Documentation

array LBFactoryMulti::$conf [protected]

Load balancer factory configuration *.

Definition at line 125 of file LBFactoryMulti.php.

array LBFactoryMulti::$externalLoads = array() [protected]

A map of external storage cluster name to server load map *.

Definition at line 100 of file LBFactoryMulti.php.

array LBFactoryMulti::$externalTemplateOverrides [protected]

A set of server info keys overriding serverTemplate for external storage.

Definition at line 105 of file LBFactoryMulti.php.

LoadBalancer [] LBFactoryMulti::$extLBs = array() [protected]

*

Definition at line 129 of file LBFactoryMulti.php.

array LBFactoryMulti::$groupLoadsByDB = array() [protected]

A 3-d map giving server load ratios by DB name *.

Definition at line 96 of file LBFactoryMulti.php.

array LBFactoryMulti::$groupLoadsBySection = array() [protected]

A 3-d map giving server load ratios for each section and group *.

Definition at line 94 of file LBFactoryMulti.php.

array LBFactoryMulti::$hostsByName = array() [protected]

A map of hostname to IP address *.

Definition at line 98 of file LBFactoryMulti.php.

string LBFactoryMulti::$lastSection [protected]

*

Definition at line 133 of file LBFactoryMulti.php.

string LBFactoryMulti::$lastWiki [protected]

*

Definition at line 131 of file LBFactoryMulti.php.

LoadBalancer [] LBFactoryMulti::$mainLBs = array() [protected]

*

Definition at line 127 of file LBFactoryMulti.php.

array LBFactoryMulti::$masterTemplateOverrides [protected]

An override array for all master servers *.

Definition at line 115 of file LBFactoryMulti.php.

LBFactoryMulti::$readOnlyBySection = array() [protected]

Definition at line 121 of file LBFactoryMulti.php.

array LBFactoryMulti::$sectionLoads [protected]

A 2-d map.

For each section, gives a map of server names to load ratios

Definition at line 84 of file LBFactoryMulti.php.

array LBFactoryMulti::$sectionsByDB [protected]

A map of database names to section names *.

Definition at line 79 of file LBFactoryMulti.php.

array LBFactoryMulti::$serverTemplate [protected]

A server info associative array as documented for $wgDBservers.

The host, hostName and load entries will be overridden

Definition at line 90 of file LBFactoryMulti.php.

array LBFactoryMulti::$templateOverridesByCluster [protected]

A 2-d map overriding the server info by external storage cluster *.

Definition at line 113 of file LBFactoryMulti.php.

array LBFactoryMulti::$templateOverridesByServer [protected]

A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis.

Applies to both core and external storage

Definition at line 111 of file LBFactoryMulti.php.


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