MediaWiki  REL1_22
ExternalStoreDB Class Reference

DB accessable external objects. More...

Inheritance diagram for ExternalStoreDB:
Collaboration diagram for ExternalStoreDB:

List of all members.

Public Member Functions

 batchFetchBlobs ($cluster, array $ids)
 Fetch multiple blob items out of the database.
 batchFetchFromURLs (array $urls)
 Fetch data from given external store URLs.
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.
 fetchFromURL ($url)
 The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage.
getLoadBalancer ($cluster)
 Get a LoadBalancer for the specified cluster.
getMaster ($cluster)
 Get a master database connection for the specified cluster.
getSlave ($cluster)
 Get a slave database connection for the specified cluster.
 getTable (&$db)
 Get the 'blobs' table name for this database.
 store ($cluster, $data)

Protected Member Functions

 parseURL ($url)

Private Member Functions

 mergeBatchResult (array &$ret, array &$ids, $res)
 Helper function for self::batchFetchBlobs for merging master/slave results.

Detailed Description

DB accessable 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 31 of file ExternalStoreDB.php.


Member Function Documentation

ExternalStoreDB::batchFetchBlobs ( cluster,
array ids 
)

Fetch multiple blob items out of the database.

Parameters:
string$clusterA cluster name valid for use with LBFactory
array$idsA map from the blob_id's to look for to the requested itemIDs in the blobs
Returns:
array A map from the blob_id's requested to their content. Unlocated ids are not represented

Definition at line 222 of file ExternalStoreDB.php.

References $dbr, $res, $ret, array(), getMaster(), getSlave(), getTable(), mergeBatchResult(), and wfDebugLog().

Referenced by batchFetchFromURLs().

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.

Parameters:
array$urlsAn array of external store URLs
Returns:
array A map from url to stored content. Failed results are not represented.

Reimplemented from ExternalStoreMedium.

Definition at line 57 of file ExternalStoreDB.php.

References $blob, $res, $ret, array(), as, batchFetchBlobs(), list, and parseURL().

& ExternalStoreDB::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.

Parameters:
$cluster
$id
$itemID
Returns:
mixed
Access:
private

Definition at line 172 of file ExternalStoreDB.php.

References $dbr, $ret, array(), false, getMaster(), getSlave(), getTable(), and wfDebugLog().

Referenced by fetchFromURL().

The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatened storage.

See also:
ExternalStoreMedium::fetchFromURL()

Reimplemented from ExternalStoreMedium.

Definition at line 38 of file ExternalStoreDB.php.

References $ret, fetchBlob(), list, and parseURL().

Get a LoadBalancer for the specified cluster.

Parameters:
string$clustercluster name
Returns:
LoadBalancer object

Definition at line 108 of file ExternalStoreDB.php.

References params, and wfGetLBFactory().

Referenced by getMaster(), and getSlave().

& ExternalStoreDB::getMaster ( cluster)

Get a master database connection for the specified cluster.

Parameters:
string$clustercluster name
Returns:
DatabaseBase object

Definition at line 142 of file ExternalStoreDB.php.

References $lb, array(), getLoadBalancer(), and params.

Referenced by batchFetchBlobs(), fetchBlob(), and store().

& ExternalStoreDB::getSlave ( cluster)

Get a slave database connection for the specified cluster.

Parameters:
string$clustercluster name
Returns:
DatabaseBase object

Definition at line 120 of file ExternalStoreDB.php.

References $lb, array(), getLoadBalancer(), global, params, and wfDebug().

Referenced by batchFetchBlobs(), and fetchBlob().

Get the 'blobs' table name for this database.

Parameters:
$dbDatabaseBase
Returns:
String: table name ('blobs' by default)

Definition at line 154 of file ExternalStoreDB.php.

Referenced by batchFetchBlobs(), fetchBlob(), and store().

ExternalStoreDB::mergeBatchResult ( array &$  ret,
array &$  ids,
res 
) [private]

Helper function for self::batchFetchBlobs for merging master/slave results.

Parameters:
array&$retCurrent self::batchFetchBlobs return value
array&$idsMap from blob_id to requested itemIDs
mixed$resDB result from DatabaseBase::select

Definition at line 260 of file ExternalStoreDB.php.

References $res, and as.

Referenced by batchFetchBlobs().

ExternalStoreDB::parseURL ( url) [protected]

Definition at line 275 of file ExternalStoreDB.php.

References $path, and array().

Referenced by batchFetchFromURLs(), and fetchFromURL().

ExternalStoreDB::store ( cluster,
data 
)
See also:
ExternalStoreMedium::store()

Reimplemented from ExternalStoreMedium.

Definition at line 86 of file ExternalStoreDB.php.

References array(), getMaster(), and getTable().

Referenced by CompressOld\compressPage().


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