Wikibase
MediaWiki Wikibase extension
|
Service interface for a inter-process locking service intended to coordinate message dispatching between multiple processes. More...
Public Member Functions | |
selectClient () | |
Selects a client wiki and locks it. | |
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. | |
lockClient (string $siteID) | |
Attempt to lock the given target wiki. | |
releaseClient (array $state) | |
Updates the given client wiki's entry in the dispatch table and releases the global lock on that wiki. | |
Service interface for a inter-process locking service intended to coordinate message dispatching between multiple processes.
The purpose of a ChangeDispatchCoordinator is to determine which client wiki to dispatch to next in a fair manner, and to prevent multiple processes to try and dispatch to the same wiki at once.
Wikibase\Repo\Store\ChangeDispatchCoordinator::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.
string[] | $clientWikiDBs | Associative array mapping client wiki IDs to client wiki (logical) database names. |
Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.
Wikibase\Repo\Store\ChangeDispatchCoordinator::lockClient | ( | string | $siteID | ) |
Attempt to lock the given target wiki.
If it can't be locked because another dispatch process is working on it, this method returns false.
string | $siteID | The ID of the client wiki to lock. |
Exception |
Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.
Wikibase\Repo\Store\ChangeDispatchCoordinator::releaseClient | ( | array | $state | ) |
Updates the given client wiki's entry in the dispatch table and releases the global lock on that wiki.
The $state parameter represents the client wiki's state after the update pass. Its structure must be the one returned by selectClient(), with the chd_seen and field updated to reflect any dispatch activity.
array | $state | Associative array representing the client wiki's state after the update pass. |
Exception |
Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.
Wikibase\Repo\Store\ChangeDispatchCoordinator::selectClient | ( | ) |
Selects a client wiki and locks it.
If no suitable client wiki can be found, this method returns null.
Note: this implementation will try a wiki from the list returned by getCandidateClients() at random. If all have been tried and failed, it returns null.
MWException | if no available client wiki could be found. |
Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.