BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
LBFactory Class Reference
Inheritance diagram for LBFactory:

Public Member Functions

 __construct (array $conf)
 
 newMainLB ($wiki=false)
 
 getMainLB ($wiki=false)
 
getExternalLB ($cluster, $wiki=false)
 
 forEachLB ($callback, array $params=[])
 
 shutdown ($flags=0)
 
 commitAll ($fname=__METHOD__)
 
 commitMasterChanges ($fname=__METHOD__, array $options=[])
 
 rollbackMasterChanges ($fname=__METHOD__)
 
 hasMasterChanges ()
 
 laggedSlaveUsed ()
 
 hasOrMadeRecentMasterChanges ()
 
 disableChronologyProtection ()
 

Static Public Member Functions

static disableBackend ()
 
static singleton ()
 
static getLBFactoryClass (array $config)
 
static destroyInstance ()
 
static setInstance ($instance)
 

Public Attributes

const SHUTDOWN_NO_CHRONPROT = 1
 

Protected Member Functions

 newExternalLB ($cluster, $wiki=false)
 
 newChronologyProtector ()
 
 shutdownChronologyProtector (ChronologyProtector $cp)
 

Protected Attributes

 $chronProt
 
 $trxProfiler
 
 $logger
 
 $readOnlyReason = false
 

Detailed Description

An interface for generating database load balancers

Constructor & Destructor Documentation

LBFactory::__construct ( array  $conf)

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

Parameters
array$conf

Member Function Documentation

LBFactory::commitAll (   $fname = __METHOD__)

Commit on all connections. Done for two reasons:

  1. To commit changes to the masters.
  2. To release the snapshot on all connections, master and slave.
    Parameters
    string$fnameCaller name
LBFactory::commitMasterChanges (   $fname = __METHOD__,
array  $options = [] 
)

Commit changes on all master connections

Parameters
string$fnameCaller name
array$optionsOptions map:
  • maxWriteDuration: abort if more than this much time was spent in write queries
static LBFactory::destroyInstance ( )
static

Shut down, close connections and destroy the cached instance.

static LBFactory::disableBackend ( )
static

Disables all access to the load balancer, will cause all database access to throw a DBAccessError

LBFactory::disableChronologyProtection ( )

Disable the ChronologyProtector for all load balancers

This can be called at the start of special API entry points

Since
1.27
LBFactory::forEachLB (   $callback,
array  $params = [] 
)
abstract

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
& LBFactory::getExternalLB (   $cluster,
  $wiki = false 
)
abstract

Get a cached (tracked) load balancer for external storage

Parameters
string$clusterExternal storage cluster, or false for core
bool | string$wikiWiki ID, or false for the current wiki
Returns
LoadBalancer
static LBFactory::getLBFactoryClass ( array  $config)
static

Returns the LBFactory class to use and the load balancer configuration.

Parameters
array$config(e.g. $wgLBFactoryConf)
Returns
string Class name
LBFactory::getMainLB (   $wiki = false)
abstract

Get a cached (tracked) load balancer object.

Parameters
bool | string$wikiWiki ID, or false for the current wiki
Returns
LoadBalancer
LBFactory::hasMasterChanges ( )

Determine if any master connection has pending changes

Returns
bool
Since
1.23
LBFactory::hasOrMadeRecentMasterChanges ( )

Determine if any master connection has pending/written changes from this request

Returns
bool
Since
1.27
LBFactory::laggedSlaveUsed ( )

Detemine if any lagged slave connection was used

Since
1.27
Returns
bool
LBFactory::newChronologyProtector ( )
protected
LBFactory::newExternalLB (   $cluster,
  $wiki = false 
)
abstractprotected

Create a new load balancer for external storage. The resulting object will be untracked, not chronology-protected, and the caller is responsible for cleaning it up.

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

Create a new load balancer object. The resulting object will be untracked, not chronology-protected, and the caller is responsible for cleaning it up.

Parameters
bool | string$wikiWiki ID, or false for the current wiki
Returns
LoadBalancer
LBFactory::rollbackMasterChanges (   $fname = __METHOD__)

Rollback changes on all master connections

Parameters
string$fnameCaller name
Since
1.23
static LBFactory::setInstance (   $instance)
static

Set the instance to be the given object

Parameters
LBFactory$instance
LBFactory::shutdown (   $flags = 0)

Prepare all tracked load balancers for shutdown

Parameters
integer$flagsSupports SHUTDOWN_* flags STUB
LBFactory::shutdownChronologyProtector ( ChronologyProtector  $cp)
protected
Parameters
ChronologyProtector$cp
static LBFactory::singleton ( )
static

Get an LBFactory instance

Returns
LBFactory

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