MediaWiki master
|
Provide primary and replica IDatabase connections. More...
Inherited by Wikimedia\Rdbms\ILBFactory.
Public Member Functions | |
commitAndWaitForReplication ( $fname, $ticket, array $opts=[]) | |
Commit primary DB transactions and wait for replication (if $ticket indicates it is safe). | |
getEmptyTransactionTicket ( $fname) | |
Get a token asserting that no write transactions are active on tracked connections. | |
getPrimaryDatabase ( $domain=false) | |
Get connection to the primary database. | |
getReplicaDatabase ( $domain=false, $group=null) | |
Get connection to a replica database. | |
Provide primary and replica IDatabase connections.
This is a narrow interface intended as the main entrypoint to the Rdbms library. No methods should be added unless absolutely needed.
The main implementation is \Wikimedia\Rdbms\LBFactory. To obtain an instance, use \MediaWiki\MediaWikiServices::getDBLoadBalancerFactory().
Definition at line 35 of file IConnectionProvider.php.
Wikimedia\Rdbms\IConnectionProvider::commitAndWaitForReplication | ( | $fname, | |
$ticket, | |||
array | $opts = [] ) |
Commit primary DB transactions and wait for replication (if $ticket indicates it is safe).
This is mostly used in jobs or deferred updates dealing with batching.
The ticket is used to check that the caller owns the transaction round or can act on behalf of the caller that owns the transaction round.
string | $fname | Caller name (e.g. METHOD) |
mixed | $ticket | Result of getEmptyTransactionTicket() |
array | $opts | Options to waitForReplication() |
Implemented in Wikimedia\Rdbms\LBFactory.
Wikimedia\Rdbms\IConnectionProvider::getEmptyTransactionTicket | ( | $fname | ) |
Get a token asserting that no write transactions are active on tracked connections.
This is mostly used in jobs or deferred updates dealing with batching.
string | $fname | Caller name (e.g. METHOD) |
Implemented in Wikimedia\Rdbms\LBFactory.
Wikimedia\Rdbms\IConnectionProvider::getPrimaryDatabase | ( | $domain = false | ) |
Get connection to the primary database.
This should be used when there the code needs to write to the database.
This method accepts virtual domains ({
string | false | $domain | Domain ID, or false for the current domain |
Implemented in Wikimedia\Rdbms\LBFactory.
Referenced by MediaWiki\Page\MergeHistory\__construct(), Wikimedia\Rdbms\DBAccessObjectUtils\getDBFromIndex(), and Wikimedia\Rdbms\DBAccessObjectUtils\getDBFromRecency().
Wikimedia\Rdbms\IConnectionProvider::getReplicaDatabase | ( | $domain = false, | |
$group = null ) |
Get connection to a replica database.
Note that a read can have replication lag.
This method accepts virtual domains ({
string | false | $domain | Domain ID, or false for the current domain |
string | null | $group | Query group; null for the default group |
Implemented in Wikimedia\Rdbms\LBFactory.
Referenced by MediaWiki\Api\ApiTag\__construct(), MediaWiki\Specials\SpecialRandomRootPage\__construct(), MediaWiki\Pager\BlockListPager\__construct(), MediaWiki\Pager\ProtectedPagesPager\__construct(), MediaWiki\Pager\ImageListPager\__construct(), MediaWiki\Pager\NewFilesPager\__construct(), MediaWiki\Pager\UsersPager\__construct(), MediaWiki\Pager\AllMessagesTablePager\__construct(), MediaWiki\Pager\CategoryPager\__construct(), MediaWiki\Pager\UploadStashPager\__construct(), MediaWiki\Pager\ProtectedTitlesPager\__construct(), MediaWiki\Pager\MergeHistoryPager\__construct(), SearchEngineFactory\getSearchEngineClass(), MediaWiki\ChangeTags\ChangeTagsStore\listExplicitlyDefinedTags(), MediaWiki\ChangeTags\ChangeTagsStore\listSoftwareActivatedTags(), MediaWiki\ChangeTags\ChangeTagsStore\listSoftwareDefinedTags(), and MediaWiki\ChangeTags\ChangeTagsStore\tagUsageStatistics().