Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Store\ChangeDispatchCoordinator Interface Reference

Service interface for a inter-process locking service intended to coordinate message dispatching between multiple processes. More...

+ Inheritance diagram for Wikibase\Repo\Store\ChangeDispatchCoordinator:

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.
 

Detailed Description

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.

Author
Daniel Kinzler

Member Function Documentation

◆ initState()

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.

Parameters
string[]$clientWikiDBsAssociative array mapping client wiki IDs to client wiki (logical) database names.

Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

◆ lockClient()

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.

Parameters
string$siteIDThe ID of the client wiki to lock.
Exceptions
Exception
Returns
array|false An associative array containing the state of the selected client wiki (see selectClient()) or false if the client wiki could not be locked.
See also
selectClient()

Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

◆ releaseClient()

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.

Parameters
array$stateAssociative array representing the client wiki's state after the update pass.
Exceptions
Exception
See also
selectWiki()

Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.

◆ selectClient()

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.

Returns
array|null An associative array containing the state of the selected client wiki (or null, if no target could be locked). Fields are:
  • chd_site: the client wiki's global site ID
  • chd_db: the client wiki's logical database name
  • chd_seen: the last change ID processed for that client wiki
  • chd_touched: timestamp giving the last time that client wiki was updated
  • chd_lock: the name of a global lock currently active for that client wiki
Exceptions
MWExceptionif no available client wiki could be found.
See also
releaseWiki()

Implemented in Wikibase\Repo\Store\Sql\SqlChangeDispatchCoordinator.


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