MediaWiki REL1_40
ExternalStoreDB Class Reference

External storage in a SQL database. More...

Inherits ExternalStoreMedium.

Collaboration diagram for ExternalStoreDB:

Public Member Functions

 __construct (array $params)
 
 batchFetchFromURLs (array $urls)
 Fetch multiple URLs from given external store.
 
 fetchFromURL ( $url)
 Fetch data from given external store URL.
 
 getPrimary ( $cluster)
 Get a primary database connection for the specified cluster.
 
 getReplica ( $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.
Parameters
string$locationThe location name
Returns
bool Whether this location is read-only
Since
1.31

 
 store ( $location, $data)
 Insert a data item into a given location.
Parameters
string$locationThe location name
string$dataThe data item
Returns
string|bool The URL of the stored data item, or false on error
Exceptions
MWException

 
- Public Member Functions inherited from ExternalStoreMedium
 setLogger (LoggerInterface $logger)
 

Protected Member Functions

 parseURL ( $url)
 

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.
 

Detailed Description

External storage in a SQL database.

In this system, each store "location" maps to a database "cluster". The clusters must be defined in the normal LBFactory configuration.

See also
ExternalStoreAccess

Definition at line 38 of file ExternalStoreDB.php.

Constructor & Destructor Documentation

◆ __construct()

ExternalStoreDB::__construct ( array $params)
See also
ExternalStoreMedium::__construct()
Parameters
array$paramsAdditional parameters include:
  • lbFactory: an LBFactory instance

Reimplemented from ExternalStoreMedium.

Definition at line 47 of file ExternalStoreDB.php.

References ExternalStoreMedium\$params.

Member Function Documentation

◆ batchFetchFromURLs()

ExternalStoreDB::batchFetchFromURLs ( array $urls)

Fetch multiple URLs from given external store.

The provided URLs are in the form of DB://cluster/id, or DB://cluster/id/itemid for concatenated storage if ConcatenatedGzipHistoryBlob was used.

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 86 of file ExternalStoreDB.php.

References $blob, $res, and parseURL().

◆ fetchFromURL()

ExternalStoreDB::fetchFromURL ( $url)

Fetch data from given external store URL.

The provided URL is in the form of DB://cluster/id or DB://cluster/id/itemid for concatenated storage if ConcatenatedGzipHistoryBlob was used.

Parameters
string$url
Returns
string|false False if missing
See also
ExternalStoreMedium::fetchFromURL()

Reimplemented from ExternalStoreMedium.

Definition at line 65 of file ExternalStoreDB.php.

References parseURL().

◆ getPrimary()

ExternalStoreDB::getPrimary ( $cluster)

Get a primary database connection for the specified cluster.

Parameters
string$clusterCluster name
Returns
\Wikimedia\Rdbms\IMaintainableDatabase
Since
1.37

Definition at line 178 of file ExternalStoreDB.php.

References DB_PRIMARY.

Referenced by CgzCopyTransaction\commit(), initializeTable(), and store().

◆ getReplica()

ExternalStoreDB::getReplica ( $cluster)

Get a replica DB connection for the specified cluster.

Since
1.34
Parameters
string$clusterCluster name
Returns
DBConnRef

Definition at line 160 of file ExternalStoreDB.php.

References DB_REPLICA.

◆ getTable()

ExternalStoreDB::getTable ( $db,
$cluster = null )

Get the 'blobs' table name for this database.

Parameters
IDatabase$db
string | null$clusterCluster name
Returns
string Table name ('blobs' by default)

Definition at line 223 of file ExternalStoreDB.php.

Referenced by initializeTable(), and store().

◆ initializeTable()

ExternalStoreDB::initializeTable ( $cluster)

Create the appropriate blobs table on this cluster.

See also
getTable()
Since
1.34
Parameters
string$cluster

Definition at line 242 of file ExternalStoreDB.php.

References $IP, getPrimary(), and getTable().

◆ isReadOnly()

ExternalStoreDB::isReadOnly ( $location)

Check if a given location is read-only.

Parameters
string$locationThe location name
Returns
bool Whether this location is read-only
Since
1.31

Reimplemented from ExternalStoreMedium.

Definition at line 135 of file ExternalStoreDB.php.

◆ parseURL()

ExternalStoreDB::parseURL ( $url)
protected
Parameters
string$url
Returns
array

Definition at line 412 of file ExternalStoreDB.php.

References $path.

Referenced by batchFetchFromURLs(), and fetchFromURL().

◆ store()

ExternalStoreDB::store ( $location,
$data )

Insert a data item into a given location.

Parameters
string$locationThe location name
string$dataThe data item
Returns
string|bool The URL of the stored data item, or false on error
Exceptions
MWException

Reimplemented from ExternalStoreMedium.

Definition at line 117 of file ExternalStoreDB.php.

References getPrimary(), and getTable().

Referenced by CgzCopyTransaction\commit().


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