Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Rdbms\DomainDb Class Reference

Encapsulation of access to MediaWiki DB related functionality that is commonly used in Wikibase. More...

+ Inheritance diagram for Wikibase\Lib\Rdbms\DomainDb:

Public Member Functions

 __construct (ILBFactory $lbFactory, string $domainId, array $loadGroups=[])
 
 sessionConsistentConnections ()
 WARNING: Do not override the load-groups in individual method calls on SessionConsistentConnectionManager. More...
 
 connections ()
 WARNING: Do not override the load-groups in individual method calls on ConnectionManager! Instead add them to the factory method! More...
 
 replication ()
 
 getEmptyTransactionTicket (string $fname)
 Only used in batch writing (replication aware). More...
 
 commitAndWaitForReplication (string $fname, $ticket)
 Only used in batch writing (replication aware). More...
 
 loadBalancer ()
 
 domain ()
 

Public Attributes

const LOAD_GROUP_FROM_CLIENT = 'from-client'
 
const LOAD_GROUP_FROM_REPO = 'from-repo'
 

Private Attributes

 $lbFactory
 
 $domainId
 
 $replicationWaiter
 
 $loadGroups
 
 $sessionConsistentConnectionManager = null
 
 $connectionManager = null
 

Detailed Description

Encapsulation of access to MediaWiki DB related functionality that is commonly used in Wikibase.

Using this class means in most cases only 1 service need be injected into a service instead of 3+ which would otherwise be needed to have access to the same functionality.

Do not type hint against this abstract class in Wikibase services. Instead, use either ClientDomainDb or RepoDomainDb depending on what kind of wiki is being accessed.

Author
Addshore

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Rdbms\DomainDb::__construct ( ILBFactory  $lbFactory,
string  $domainId,
array  $loadGroups = [] 
)

Member Function Documentation

◆ commitAndWaitForReplication()

Wikibase\Lib\Rdbms\DomainDb::commitAndWaitForReplication ( string  $fname,
  $ticket 
)

Only used in batch writing (replication aware).

See https://www.mediawiki.org/wiki/Database_transactions#Splitting_writes_into_multiple_transactions

Parameters
string$fnameCaller name (e.g. METHOD)
mixed$ticketResult of getEmptyTransactionTicket()
Returns
bool True if the wait was successful, false on timeout

◆ connections()

Wikibase\Lib\Rdbms\DomainDb::connections ( )

WARNING: Do not override the load-groups in individual method calls on ConnectionManager! Instead add them to the factory method!

◆ domain()

Wikibase\Lib\Rdbms\DomainDb::domain ( )
Deprecated:
Don't use this unless it needs to be passed to a service we don't control

◆ getEmptyTransactionTicket()

Wikibase\Lib\Rdbms\DomainDb::getEmptyTransactionTicket ( string  $fname)

Only used in batch writing (replication aware).

See https://www.mediawiki.org/wiki/Database_transactions#Splitting_writes_into_multiple_transactions

Parameters
string$fnameCaller name (e.g. METHOD)
Returns
mixed A value to pass to commitAndWaitForReplication()

◆ loadBalancer()

Wikibase\Lib\Rdbms\DomainDb::loadBalancer ( )
Deprecated:
Don't use this unless it needs to be passed to a service we don't control

◆ replication()

Wikibase\Lib\Rdbms\DomainDb::replication ( )

◆ sessionConsistentConnections()

Wikibase\Lib\Rdbms\DomainDb::sessionConsistentConnections ( )

WARNING: Do not override the load-groups in individual method calls on SessionConsistentConnectionManager.

Instead add them to the factory method!

Member Data Documentation

◆ $connectionManager

Wikibase\Lib\Rdbms\DomainDb::$connectionManager = null
private

◆ $domainId

Wikibase\Lib\Rdbms\DomainDb::$domainId
private

◆ $lbFactory

Wikibase\Lib\Rdbms\DomainDb::$lbFactory
private

◆ $loadGroups

Wikibase\Lib\Rdbms\DomainDb::$loadGroups
private

◆ $replicationWaiter

Wikibase\Lib\Rdbms\DomainDb::$replicationWaiter
private

◆ $sessionConsistentConnectionManager

Wikibase\Lib\Rdbms\DomainDb::$sessionConsistentConnectionManager = null
private

◆ LOAD_GROUP_FROM_CLIENT

const Wikibase\Lib\Rdbms\DomainDb::LOAD_GROUP_FROM_CLIENT = 'from-client'

◆ LOAD_GROUP_FROM_REPO

const Wikibase\Lib\Rdbms\DomainDb::LOAD_GROUP_FROM_REPO = 'from-repo'

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