jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/332760 )
Change subject: Add EntityDataRetrievalServiceFactory interface
......................................................................
Add EntityDataRetrievalServiceFactory interface
Introduces generic interface for factories providing services
for retrieval/lookup of entity data.
DispatchingServiceFactory implements the new interface,
providing dispatching wrappers around lookup services.
DirectSqlStore does not need to know about implementation details
of the particular factory it uses, therefore it now expectes any
EntityDataRetrievalServiceFactory implementation.
WikibaseClient also hides implementation details and exposes
EntityDataRetrievalServiceFactory object without limiting to
the particular implementation.
Bug: T155623
Change-Id: I1d545ca947e3e8b5c3dcae667a582a57a54b0a39
---
M client/includes/DispatchingServiceFactory.php
A client/includes/EntityDataRetrievalServiceFactory.php
M client/includes/Store/Sql/DirectSqlStore.php
M client/includes/WikibaseClient.php
4 files changed, 49 insertions(+), 19 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/client/includes/DispatchingServiceFactory.php
b/client/includes/DispatchingServiceFactory.php
index 4af6e76..28ca917 100644
--- a/client/includes/DispatchingServiceFactory.php
+++ b/client/includes/DispatchingServiceFactory.php
@@ -20,7 +20,7 @@
*
* @license GPL-2.0+
*/
-class DispatchingServiceFactory extends ServiceContainer {
+class DispatchingServiceFactory extends ServiceContainer implements
EntityDataRetrievalServiceFactory {
/**
* @var RepositoryServiceContainer[]
diff --git a/client/includes/EntityDataRetrievalServiceFactory.php
b/client/includes/EntityDataRetrievalServiceFactory.php
new file mode 100644
index 0000000..7634da3
--- /dev/null
+++ b/client/includes/EntityDataRetrievalServiceFactory.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Wikibase\Client;
+
+use Wikibase\DataModel\Services\Term\TermBuffer;
+use Wikibase\Lib\Store\EntityRevisionLookup;
+use Wikibase\Lib\Store\PropertyInfoLookup;
+
+/**
+ * An interface of a factory of data retrieval/lookup services.
+ *
+ * @license GPL-2.0+
+ */
+interface EntityDataRetrievalServiceFactory {
+
+ /**
+ * @return EntityRevisionLookup
+ */
+ public function getEntityRevisionLookup();
+
+ /**
+ * @return PropertyInfoLookup
+ */
+ public function getPropertyInfoLookup();
+
+ /**
+ * @return TermBuffer
+ */
+ public function getTermBuffer();
+
+}
diff --git a/client/includes/Store/Sql/DirectSqlStore.php
b/client/includes/Store/Sql/DirectSqlStore.php
index 8a2329a..2597088 100644
--- a/client/includes/Store/Sql/DirectSqlStore.php
+++ b/client/includes/Store/Sql/DirectSqlStore.php
@@ -4,12 +4,11 @@
use HashBagOStuff;
use ObjectCache;
-use Wikibase\Client\DispatchingServiceFactory;
+use Wikibase\Client\EntityDataRetrievalServiceFactory;
use Wikibase\Client\RecentChanges\RecentChangesDuplicateDetector;
use Wikibase\Client\Store\Sql\PagePropsEntityIdLookup;
use Wikibase\Lib\Store\CachingPropertyInfoLookup;
use Wikibase\Lib\Store\PropertyInfoLookup;
-use Wikibase\Lib\Store\Sql\PropertyInfoTable;
use Wikimedia\Rdbms\SessionConsistentConnectionManager;
use Wikibase\Client\Store\UsageUpdater;
use Wikibase\Client\Usage\Sql\SqlSubscriptionManager;
@@ -110,9 +109,9 @@
private $entityRevisionLookup = null;
/**
- * @var DispatchingServiceFactory
+ * @var EntityDataRetrievalServiceFactory
*/
- private $dispatchingServiceFactory = null;
+ private $entityDataRetrievalServices = null;
/**
* @var PropertyLabelResolver|null
@@ -175,7 +174,7 @@
* @param EntityIdParser $entityIdParser
* @param EntityIdComposer $entityIdComposer
* @param EntityNamespaceLookup $entityNamespaceLookup
- * @param DispatchingServiceFactory $dispatchingServiceFactory
+ * @param EntityDataRetrievalServiceFactory
$entityDataRetrievalServiceFactory
* @param string|bool $repoWiki The symbolic database name of the repo
wiki or false for the
* local wiki.
* @param string $languageCode
@@ -186,7 +185,7 @@
EntityIdParser $entityIdParser,
EntityIdComposer $entityIdComposer,
EntityNamespaceLookup $entityNamespaceLookup,
- DispatchingServiceFactory $dispatchingServiceFactory,
+ EntityDataRetrievalServiceFactory
$entityDataRetrievalServiceFactory,
$repoWiki = false,
$languageCode
) {
@@ -195,7 +194,7 @@
$this->entityIdParser = $entityIdParser;
$this->entityIdComposer = $entityIdComposer;
$this->entityNamespaceLookup = $entityNamespaceLookup;
- $this->dispatchingServiceFactory = $dispatchingServiceFactory;
+ $this->entityDataRetrievalServices =
$entityDataRetrievalServiceFactory;
$this->repoWiki = $repoWiki;
$this->languageCode = $languageCode;
@@ -338,7 +337,7 @@
// NOTE: Keep cache key in sync with
SqlStore::newEntityRevisionLookup in WikibaseRepo
$cacheKeyPrefix = $this->cacheKeyPrefix .
':WikiPageEntityRevisionLookup';
- $dispatchingLookup =
$this->dispatchingServiceFactory->getEntityRevisionLookup();
+ $dispatchingLookup =
$this->entityDataRetrievalServices->getEntityRevisionLookup();
// Lower caching layer using persistent cache (e.g. memcached).
$persistentCachingLookup = new CachingEntityRevisionLookup(
@@ -439,7 +438,7 @@
*/
public function getPropertyInfoLookup() {
if ( $this->propertyInfoLookup === null ) {
- $propertyInfoLookup =
$this->dispatchingServiceFactory->getPropertyInfoLookup();
+ $propertyInfoLookup =
$this->entityDataRetrievalServices->getPropertyInfoLookup();
$cacheKey = $this->cacheKeyPrefix .
':CacheAwarePropertyInfoStore';
$this->propertyInfoLookup = new
CachingPropertyInfoLookup(
diff --git a/client/includes/WikibaseClient.php
b/client/includes/WikibaseClient.php
index be8b86a..1cc0818 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -120,9 +120,9 @@
private $siteLookup;
/**
- * @var DispatchingServiceFactory
+ * @var EntityDataRetrievalServiceFactory
*/
- private $dispatchingServiceFactory;
+ private $entityDataRetrievalServiceFactory;
/**
* @var PropertyDataTypeLookup|null
@@ -381,17 +381,17 @@
}
/**
- * @return DispatchingServiceFactory
+ * @return EntityDataRetrievalServiceFactory
*/
- private function getDispatchingServiceFactory() {
- if ( $this->dispatchingServiceFactory === null ) {
+ private function getEntityDataRetrievalServiceFactory() {
+ if ( $this->entityDataRetrievalServiceFactory === null ) {
$factory = new DispatchingServiceFactory( $this );
$factory->loadWiringFiles( $this->settings->getSetting(
'dispatchingServiceWiringFiles' ) );
- $this->dispatchingServiceFactory = $factory;
+ $this->entityDataRetrievalServiceFactory = $factory;
}
- return $this->dispatchingServiceFactory;
+ return $this->entityDataRetrievalServiceFactory;
}
/**
@@ -420,7 +420,7 @@
*/
private function getPrefetchingTermLookup() {
if ( !$this->termLookup ) {
- $this->termLookup =
$this->getDispatchingServiceFactory()->getTermBuffer();
+ $this->termLookup =
$this->getEntityDataRetrievalServiceFactory()->getTermBuffer();
}
return $this->termLookup;
@@ -533,7 +533,7 @@
$this->getEntityIdParser(),
$this->getEntityIdComposer(),
$this->getEntityNamespaceLookup(),
- $this->getDispatchingServiceFactory(),
+ $this->getEntityDataRetrievalServiceFactory(),
$repoDatabase,
$this->contentLanguage->getCode()
);
--
To view, visit https://gerrit.wikimedia.org/r/332760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d545ca947e3e8b5c3dcae667a582a57a54b0a39
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: WMDE-leszek <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits