-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Add virtual-wikibase-terms virtual domain"
- Loading branch information
Showing
12 changed files
with
174 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace Wikibase\Lib\Rdbms; | ||
|
||
use Wikimedia\Rdbms\IDatabase; | ||
use Wikimedia\Rdbms\ILBFactory; | ||
use Wikimedia\Rdbms\IReadableDatabase; | ||
|
||
/** | ||
* Accesses terms (labels, descriptions, aliases) database tables via virtual domain. | ||
* | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class VirtualTermsDomainDb implements TermsDomainDb { | ||
|
||
public const VIRTUAL_DOMAIN_ID = 'virtual-wikibase-terms'; | ||
|
||
private ILBFactory $lbFactory; | ||
|
||
public function __construct( ILBFactory $lbFactory ) { | ||
$this->lbFactory = $lbFactory; | ||
} | ||
|
||
public function getWriteConnection(): IDatabase { | ||
return $this->lbFactory->getPrimaryDatabase( self::VIRTUAL_DOMAIN_ID ); | ||
} | ||
|
||
public function getAutoCommitPrimaryConnection(): IDatabase { | ||
return $this->lbFactory->getAutoCommitPrimaryConnection( self::VIRTUAL_DOMAIN_ID ); | ||
} | ||
|
||
public function getReadConnection( ?array $groups = null ): IReadableDatabase { | ||
return $this->lbFactory->getReplicaDatabase( self::VIRTUAL_DOMAIN_ID ); | ||
} | ||
|
||
public function waitForReplicationOfAllAffectedClusters( ?int $timeout = null ): void { | ||
$this->lbFactory->waitForReplication( array_filter( [ | ||
'timeout' => $timeout, | ||
] ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters