Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator Class Reference

SQL-based implementation of ChangeDispatchCoordinator when there is a LockManager implementation provided to be used instead of SqlChangeDisptachCoordinator's own locking. More...

+ Inheritance diagram for Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator:
+ Collaboration diagram for Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator:

Public Member Functions

 __construct (LockManager $lockManager, ILBFactory $LBFactory, LoggerInterface $logger, $repoDB, string $repoSiteId)
 
- Public Member Functions inherited from Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator
 __construct ( $repoDB, string $repoSiteId, ILBFactory $LBFactory, LoggerInterface $logger)
 
 setBatchSize (int $batchSize)
 Sets the number of changes we would prefer to process in one go. More...
 
 setMessageReporter (MessageReporter $messageReporter)
 
 setRandomness (int $randomness)
 Sets the randomness level: selectClient() will randomly pick one of the $randomness most lagged eligible client wikis. More...
 
 setDispatchInterval (int $dispatchInterval)
 Sets the number of seconds we would prefer to let a client "rest" before dispatching to it again. More...
 
 setArrayRandOverride (callable $array_rand)
 Set override for array_rand(), for testing. More...
 
 setTimeOverride (callable $time)
 Set override for time(), for testing. More...
 
 setEngageClientLockOverride (callable $engageClientLockOverride)
 Set override for $db->lock, for testing. More...
 
 setIsClientLockUsedOverride (callable $isClientLockUsedOverride)
 Set override for !$db->lockIsFree, for testing. More...
 
 setReleaseClientLockOverride (callable $releaseClientLockOverride)
 Set override for $db->unlock, for testing. More...
 
 setStateTable (string $stateTable)
 
 setChangesTable (string $changesTable)
 
 selectClient ()
 Selects a client wiki and locks it. More...
 
 initState (array $clientWikiDBs)
 Initializes the dispatch table by injecting dummy records for all target wikis that are in the configuration but not yet in the dispatch table. More...
 
 lockClient (string $siteID)
 Attempt to lock the given target wiki. More...
 
 releaseClient (array $state)
 Updates the given client wiki's entry in the dispatch table and releases the global lock on that wiki. More...
 

Protected Member Functions

 engageClientLock (string $lock)
 
 releaseClientLock (IDatabase $db, string $lock)
 
 isClientLockUsed (IDatabase $db, string $lock)
 

Private Attributes

 $lockManager
 

Detailed Description

SQL-based implementation of ChangeDispatchCoordinator when there is a LockManager implementation provided to be used instead of SqlChangeDisptachCoordinator's own locking.

Author
Amir Sarabadani ladsg.nosp@m.roup.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator::__construct ( LockManager  $lockManager,
ILBFactory  $LBFactory,
LoggerInterface  $logger,
  $repoDB,
string  $repoSiteId 
)
Parameters
LockManager$lockManager
ILBFactory$LBFactory
LoggerInterface$logger
string | false$repoDB
string$repoSiteIdThe repo's global wiki ID

Member Function Documentation

◆ engageClientLock()

Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator::engageClientLock ( string  $lock)
protected
See also
SqlChangeDispatchCoordinator::engageClientLock()
Parameters
string$lockThe name of the lock to engage.
Returns
bool whether the lock was engaged successfully.

Reimplemented from Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

◆ isClientLockUsed()

Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator::isClientLockUsed ( IDatabase  $db,
string  $lock 
)
protected
See also
SqlChangeDispatchCoordinator::isClientLockUsed()
Parameters
IDatabase$dbThe database connection to work on.
string$lockThe name of the lock to check.
Returns
bool false since it's not needed in LockManager-based coordinators

Reimplemented from Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

◆ releaseClientLock()

Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator::releaseClientLock ( IDatabase  $db,
string  $lock 
)
protected
See also
SqlChangeDispatchCoordinator::releaseClient()
Parameters
IDatabase$dbThe database connection to work on.
string$lockThe name of the lock to release.
Returns
bool whether the lock was released successfully.

Reimplemented from Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

Member Data Documentation

◆ $lockManager

Wikibase\Repo\Store\Sql\LockManagerSqlChangeDispatchCoordinator::$lockManager
private

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