MediaWiki REL1_37
|
DB accessible external objects. More...
Public Member Functions | |||||||||
__construct (array $params) | |||||||||
batchFetchFromURLs (array $urls) | |||||||||
Fetch data from given external store URLs. | |||||||||
fetchFromURL ( $url) | |||||||||
The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage. | |||||||||
getMaster ( $cluster) | |||||||||
getPrimary ( $cluster) | |||||||||
Get a primary database connection for the specified cluster. | |||||||||
getReplica ( $cluster) | |||||||||
Get a replica DB connection for the specified cluster. | |||||||||
getSlave ( $cluster) | |||||||||
Get a replica DB connection for the specified cluster. | |||||||||
getTable ( $db, $cluster=null) | |||||||||
Get the 'blobs' table name for this database. | |||||||||
initializeTable ( $cluster) | |||||||||
Create the appropriate blobs table on this cluster. | |||||||||
isReadOnly ( $location) | |||||||||
Check if a given location is read-only.
| |||||||||
store ( $location, $data) | |||||||||
Insert a data item into a given location.
| |||||||||
Public Member Functions inherited from ExternalStoreMedium | |||||||||
setLogger (LoggerInterface $logger) | |||||||||
Protected Member Functions | |
parseURL ( $url) | |
Private Member Functions | |
batchFetchBlobs ( $cluster, array $ids) | |
Fetch multiple blob items out of the database. | |
fetchBlob ( $cluster, $id, $itemID) | |
Fetch a blob item out of the database; a cache of the last-loaded blob will be kept so that multiple loads out of a multi-item blob can avoid redundant database access and decompression. | |
getDomainId (array $server) | |
getLoadBalancer ( $cluster) | |
Get a LoadBalancer for the specified cluster. | |
mergeBatchResult (array &$ret, array &$ids, $res) | |
Helper function for self::batchFetchBlobs for merging primary/replica DB results. | |
Private Attributes | |
LBFactory | $lbFactory |
Additional Inherited Members | |
Protected Attributes inherited from ExternalStoreMedium | |
string | $dbDomain |
Default database domain to store content under. | |
bool | $isDbDomainExplicit |
Whether this was factoried with an explicit DB domain. | |
LoggerInterface | $logger |
array | $params = [] |
Usage context options for this instance. | |
DB accessible external objects.
In this system, each store "location" maps to a database "cluster". The clusters must be defined in the normal LBFactory configuration.
Definition at line 40 of file ExternalStoreDB.php.
ExternalStoreDB::__construct | ( | array | $params | ) |
array | $params | Additional parameters include:
|
Reimplemented from ExternalStoreMedium.
Definition at line 49 of file ExternalStoreDB.php.
References ExternalStoreMedium\$params.
|
private |
Fetch multiple blob items out of the database.
string | $cluster | A cluster name valid for use with LBFactory |
array | $ids | A map from the blob_id's to look for to the requested itemIDs in the blobs |
Definition at line 365 of file ExternalStoreDB.php.
References $dbr, $res, getPrimary(), getReplica(), getTable(), and mergeBatchResult().
Referenced by batchFetchFromURLs().
ExternalStoreDB::batchFetchFromURLs | ( | array | $urls | ) |
Fetch data from given external store URLs.
The provided URLs are in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage.
array | $urls | An array of external store URLs |
Reimplemented from ExternalStoreMedium.
Definition at line 85 of file ExternalStoreDB.php.
References $blob, $res, batchFetchBlobs(), and parseURL().
|
private |
Fetch a blob item out of the database; a cache of the last-loaded blob will be kept so that multiple loads out of a multi-item blob can avoid redundant database access and decompression.
string | $cluster | |
string | $id | |
string | $itemID |
Definition at line 304 of file ExternalStoreDB.php.
References $dbr, getPrimary(), getReplica(), getTable(), and unserialize().
Referenced by fetchFromURL().
ExternalStoreDB::fetchFromURL | ( | $url | ) |
The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage.
string | $url |
Reimplemented from ExternalStoreMedium.
Definition at line 65 of file ExternalStoreDB.php.
References fetchBlob(), and parseURL().
|
private |
array | $server | Primary DB server configuration array for LoadBalancer |
Definition at line 217 of file ExternalStoreDB.php.
References ExternalStoreMedium\$dbDomain.
Referenced by getPrimary(), getReplica(), and isReadOnly().
|
private |
Get a LoadBalancer for the specified cluster.
string | $cluster | Cluster name |
Definition at line 151 of file ExternalStoreDB.php.
Referenced by getPrimary(), getReplica(), getTable(), and isReadOnly().
ExternalStoreDB::getMaster | ( | $cluster | ) |
string | $cluster | Cluster name |
Definition at line 208 of file ExternalStoreDB.php.
References getPrimary(), and wfDeprecated().
ExternalStoreDB::getPrimary | ( | $cluster | ) |
Get a primary database connection for the specified cluster.
string | $cluster | Cluster name |
Definition at line 192 of file ExternalStoreDB.php.
References DB_PRIMARY, getDomainId(), and getLoadBalancer().
Referenced by batchFetchBlobs(), fetchBlob(), getMaster(), initializeTable(), and store().
ExternalStoreDB::getReplica | ( | $cluster | ) |
Get a replica DB connection for the specified cluster.
string | $cluster | Cluster name |
Definition at line 162 of file ExternalStoreDB.php.
References DB_REPLICA, getDomainId(), and getLoadBalancer().
Referenced by batchFetchBlobs(), fetchBlob(), and getSlave().
ExternalStoreDB::getSlave | ( | $cluster | ) |
Get a replica DB connection for the specified cluster.
string | $cluster | Cluster name |
Definition at line 180 of file ExternalStoreDB.php.
References getReplica(), and wfDeprecated().
ExternalStoreDB::getTable | ( | $db, | |
$cluster = null |
|||
) |
Get the 'blobs' table name for this database.
IDatabase | $db | |
string | null | $cluster | Cluster name |
Definition at line 247 of file ExternalStoreDB.php.
References getLoadBalancer().
Referenced by batchFetchBlobs(), fetchBlob(), initializeTable(), and store().
ExternalStoreDB::initializeTable | ( | $cluster | ) |
Create the appropriate blobs table on this cluster.
string | $cluster |
Definition at line 266 of file ExternalStoreDB.php.
References $IP, getPrimary(), and getTable().
ExternalStoreDB::isReadOnly | ( | $location | ) |
Check if a given location is read-only.
string | $location | The location name |
Reimplemented from ExternalStoreMedium.
Definition at line 134 of file ExternalStoreDB.php.
References getDomainId(), and getLoadBalancer().
|
private |
Helper function for self::batchFetchBlobs for merging primary/replica DB results.
array | &$ret | Current self::batchFetchBlobs return value |
array | &$ids | Map from blob_id to requested itemIDs |
mixed | $res | DB result from Database::select |
Definition at line 414 of file ExternalStoreDB.php.
References $res, and unserialize().
Referenced by batchFetchBlobs().
|
protected |
string | $url |
Definition at line 433 of file ExternalStoreDB.php.
References $path.
Referenced by batchFetchFromURLs(), and fetchFromURL().
ExternalStoreDB::store | ( | $location, | |
$data | |||
) |
Insert a data item into a given location.
string | $location | The location name |
string | $data | The data item |
MWException |
Reimplemented from ExternalStoreMedium.
Definition at line 116 of file ExternalStoreDB.php.
References getPrimary(), and getTable().
|
private |
Definition at line 42 of file ExternalStoreDB.php.