MediaWiki  master
Wikimedia\DependencyStore\SqlModuleDependencyStore Class Reference

Class for tracking per-entity dependency path lists in the module_deps table. More...

Inheritance diagram for Wikimedia\DependencyStore\SqlModuleDependencyStore:
Collaboration diagram for Wikimedia\DependencyStore\SqlModuleDependencyStore:

Public Member Functions

 __construct (ILoadBalancer $lb)
 
 remove ( $type, $entities)
 Delete the currently tracked dependencies for an entity or set of entities. More...
 
 renew ( $type, $entities, $ttl)
 Set the expiry for the currently tracked dependencies for an entity or set of entities. More...
 
 retrieveMulti ( $type, array $entities)
 Get the currently tracked dependencies for a set of entities. More...
 
 storeMulti ( $type, array $dataByEntity, $ttl)
 Set the currently tracked dependencies for a set of entities. More...
 
- Public Member Functions inherited from Wikimedia\DependencyStore\DependencyStore
 newEntityDependencies (array $paths=[], $asOf=null)
 
 retrieve ( $type, $entity)
 Get the currently tracked dependencies for an entity. More...
 
 store ( $type, $entity, array $data, $ttl)
 Set the currently tracked dependencies for an entity. More...
 

Private Member Functions

 fetchDependencyBlobs (array $entities, IDatabase $db)
 
 getEntityNameComponents ( $entity)
 
 getMasterDb ()
 
 getReplicaDb ()
 

Private Attributes

ILoadBalancer $lb
 

Detailed Description

Class for tracking per-entity dependency path lists in the module_deps table.

This should not be used outside of ResourceLoader and ResourceLoaderModule

Definition at line 37 of file SqlModuleDependencyStore.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\DependencyStore\SqlModuleDependencyStore::__construct ( ILoadBalancer  $lb)
Parameters
ILoadBalancer$lbStorage backend

Definition at line 44 of file SqlModuleDependencyStore.php.

References Wikimedia\DependencyStore\SqlModuleDependencyStore\$lb.

Member Function Documentation

◆ fetchDependencyBlobs()

Wikimedia\DependencyStore\SqlModuleDependencyStore::fetchDependencyBlobs ( array  $entities,
IDatabase  $db 
)
private

◆ getEntityNameComponents()

Wikimedia\DependencyStore\SqlModuleDependencyStore::getEntityNameComponents (   $entity)
private

◆ getMasterDb()

Wikimedia\DependencyStore\SqlModuleDependencyStore::getMasterDb ( )
private

◆ getReplicaDb()

Wikimedia\DependencyStore\SqlModuleDependencyStore::getReplicaDb ( )
private
Returns
DBConnRef

Definition at line 188 of file SqlModuleDependencyStore.php.

References DB_REPLICA.

Referenced by Wikimedia\DependencyStore\SqlModuleDependencyStore\retrieveMulti().

◆ remove()

Wikimedia\DependencyStore\SqlModuleDependencyStore::remove (   $type,
  $entities 
)

Delete the currently tracked dependencies for an entity or set of entities.

Parameters
string$typeEntity type
string | string[]$entitiesEntity name(s)
Exceptions
DependencyStoreException

Reimplemented from Wikimedia\DependencyStore\DependencyStore.

Definition at line 117 of file SqlModuleDependencyStore.php.

References Wikimedia\DependencyStore\SqlModuleDependencyStore\getEntityNameComponents(), Wikimedia\DependencyStore\SqlModuleDependencyStore\getMasterDb(), LIST_AND, and LIST_OR.

◆ renew()

Wikimedia\DependencyStore\SqlModuleDependencyStore::renew (   $type,
  $entities,
  $ttl 
)

Set the expiry for the currently tracked dependencies for an entity or set of entities.

Parameters
string$typeEntity type
string | string[]$entitiesEntity name(s)
int$ttlNew time-to-live in seconds
Exceptions
DependencyStoreException

Reimplemented from Wikimedia\DependencyStore\DependencyStore.

Definition at line 142 of file SqlModuleDependencyStore.php.

◆ retrieveMulti()

Wikimedia\DependencyStore\SqlModuleDependencyStore::retrieveMulti (   $type,
array  $entities 
)

Get the currently tracked dependencies for a set of entities.

See also
KeyValueDependencyStore::retrieve()
Parameters
string$typeEntity type
string[]$entitiesEntity names
Returns
array[] Map of (entity => (paths: paths, asOf: UNIX timestamp or null))
Exceptions
DependencyStoreException

Reimplemented from Wikimedia\DependencyStore\DependencyStore.

Definition at line 48 of file SqlModuleDependencyStore.php.

References $dbr, Wikimedia\DependencyStore\SqlModuleDependencyStore\fetchDependencyBlobs(), Wikimedia\DependencyStore\SqlModuleDependencyStore\getReplicaDb(), and Wikimedia\DependencyStore\DependencyStore\newEntityDependencies().

◆ storeMulti()

Wikimedia\DependencyStore\SqlModuleDependencyStore::storeMulti (   $type,
array  $dataByEntity,
  $ttl 
)

Set the currently tracked dependencies for a set of entities.

See also
KeyValueDependencyStore::store()
Parameters
string$typeEntity type
array[]$dataByEntityMap of (entity => (paths: paths, asOf: UNIX timestamp or null))
int$ttlNew time-to-live in seconds
Exceptions
DependencyStoreException

Reimplemented from Wikimedia\DependencyStore\DependencyStore.

Definition at line 71 of file SqlModuleDependencyStore.php.

References $blob, Wikimedia\DependencyStore\SqlModuleDependencyStore\fetchDependencyBlobs(), Wikimedia\DependencyStore\SqlModuleDependencyStore\getEntityNameComponents(), and Wikimedia\DependencyStore\SqlModuleDependencyStore\getMasterDb().

Member Data Documentation

◆ $lb

ILoadBalancer Wikimedia\DependencyStore\SqlModuleDependencyStore::$lb
private

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