Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase Class Reference

Base class for item/property TermStoreWriters. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase:

Public Member Functions

 __construct (TermsDomainDb $termsDb, JobQueueGroup $jobQueueGroup, TermInLangIdsAcquirer $termInLangIdsAcquirer, TermInLangIdsResolver $termInLangIdsResolver, StringNormalizer $stringNormalizer)
 

Protected Member Functions

 delete (Int32EntityId $entityId)
 
 store (Int32EntityId $entityId, Fingerprint $fingerprint)
 

Private Member Functions

 getDbw ()
 
 submitJobToCleanTermStorageRowsIfUnused (array $termInLangIdsToClean)
 
 acquireAndInsertTerms (Int32EntityId $entityId, Fingerprint $fingerprint)
 Acquire term in lang IDs for the given Fingerprint, store them in the table for the given entity ID, and return term in lang IDs that are no longer referenced and might now need to be cleaned up.
 
 deleteTermsWithoutClean (Int32EntityId $entityId)
 Delete rows for the given Int32EntityId, and return term in lang IDs that are no longer referenced and might now need to be cleaned up.
 

Private Attributes

 $termsDb
 
 $termInLangIdsAcquirer
 
 $termInLangIdsResolver
 
 $stringNormalizer
 
 $jobQueueGroup
 

Detailed Description

Base class for item/property TermStoreWriters.

See also
Item & Property Terms

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::__construct ( TermsDomainDb $termsDb,
JobQueueGroup $jobQueueGroup,
TermInLangIdsAcquirer $termInLangIdsAcquirer,
TermInLangIdsResolver $termInLangIdsResolver,
StringNormalizer $stringNormalizer )

Member Function Documentation

◆ acquireAndInsertTerms()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::acquireAndInsertTerms ( Int32EntityId $entityId,
Fingerprint $fingerprint )
private

Acquire term in lang IDs for the given Fingerprint, store them in the table for the given entity ID, and return term in lang IDs that are no longer referenced and might now need to be cleaned up.

Updating the current state is done on a best effort basis. Because this method is called as a secondary data update, not in the primary transaction, (nearly) simultaneous edits to the same entity can race on the term store update, and the final state does not necessarily correspond to the terms of the latest revision. (In theory, it may even be a mixture of the terms of several revisions, without exactly matching any of them.) However, any future terms update should fix such a situation (any out-of-sync state should not survive through later updates). Additionally, all removed <prefix>_term_in_lang_ids will always be accurately reported: we will never silently remove a reference to the wbt_term_in_lang table.

Parameters
Int32EntityId$entityId
Fingerprint$fingerprint
Returns
int[] <prefix>term_in_lang_ids that we removed (references to the wbt_term_in_lang table). The returned term in lang IDs might still be used in other wbt<entity>_terms rows, in case of a race condition potentially even on the same entity. This should be checked just before cleanup. However, that may happen in a different transaction than this call.

◆ delete()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::delete ( Int32EntityId $entityId)
protected

◆ deleteTermsWithoutClean()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::deleteTermsWithoutClean ( Int32EntityId $entityId)
private

Delete rows for the given Int32EntityId, and return term in lang IDs that are no longer referenced and might now need to be cleaned up.

(The returned term in lang IDs might still be used in wbt_<entity>_terms rows for other entity IDs, and this should be checked just before cleanup. However, that may happen in a different transaction than this call.)

Parameters
Int32EntityId$entityId
Returns
int[]

◆ getDbw()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::getDbw ( )
private

◆ store()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::store ( Int32EntityId $entityId,
Fingerprint $fingerprint )
protected

◆ submitJobToCleanTermStorageRowsIfUnused()

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::submitJobToCleanTermStorageRowsIfUnused ( array $termInLangIdsToClean)
private

Member Data Documentation

◆ $jobQueueGroup

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::$jobQueueGroup
private

◆ $stringNormalizer

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::$stringNormalizer
private

◆ $termInLangIdsAcquirer

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::$termInLangIdsAcquirer
private

◆ $termInLangIdsResolver

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::$termInLangIdsResolver
private

◆ $termsDb

Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::$termsDb
private

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