MediaWiki  1.34.0
ExternalStoreAccess Class Reference

Key/value blob storage for a collection of storage medium types (e.g. More...

Inheritance diagram for ExternalStoreAccess:
Collaboration diagram for ExternalStoreAccess:

Public Member Functions

 __construct (ExternalStoreFactory $factory, LoggerInterface $logger=null)
 
 fetchFromURL ( $url, array $params=[])
 Fetch data from given URL. More...
 
 fetchFromURLs (array $urls, array $params=[])
 Fetch data from multiple URLs with a minimum of round trips. More...
 
 insert ( $data, array $params=[], array $tryStores=null)
 Insert data into storage and return the assigned URL. More...
 
 isReadOnly ( $storeUrls=null)
 
 setLogger (LoggerInterface $logger)
 

Private Attributes

LoggerInterface $logger
 
ExternalStoreFactory $storeFactory
 

Detailed Description

Key/value blob storage for a collection of storage medium types (e.g.

RDBMs, files)

Multiple medium types can be active and each one can have multiple "locations" available. Blobs are stored under URLs of the form "<protocol>://<location>/<path>". Each type of storage medium has an associated protocol. Insertions will randomly pick mediums and locations from the provided list of writable medium-qualified locations. Insertions will also fail-over to other writable locations or mediums if one or more are not available.

Since
1.34

Definition at line 22 of file ExternalStoreAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ExternalStoreAccess::__construct ( ExternalStoreFactory  $factory,
LoggerInterface  $logger = null 
)
Parameters
ExternalStoreFactory$factory
LoggerInterface | null$logger

Definition at line 32 of file ExternalStoreAccess.php.

References $logger.

Member Function Documentation

◆ fetchFromURL()

ExternalStoreAccess::fetchFromURL (   $url,
array  $params = [] 
)

Fetch data from given URL.

See also
ExternalStoreFactory::getStore()
Parameters
string$urlThe URL of the text to get
array$paramsMap of context parameters; same as ExternalStoreFactory::getStore()
Returns
string|bool The text stored or false on error
Exceptions
ExternalStoreException

Definition at line 51 of file ExternalStoreAccess.php.

◆ fetchFromURLs()

ExternalStoreAccess::fetchFromURLs ( array  $urls,
array  $params = [] 
)

Fetch data from multiple URLs with a minimum of round trips.

See also
ExternalStoreFactory::getStore()
Parameters
array$urlsThe URLs of the text to get
array$paramsMap of context parameters; same as ExternalStoreFactory::getStore()
Returns
array Map of (url => string or false if not found)
Exceptions
ExternalStoreException

Definition at line 65 of file ExternalStoreAccess.php.

◆ insert()

ExternalStoreAccess::insert (   $data,
array  $params = [],
array  $tryStores = null 
)

Insert data into storage and return the assigned URL.

This will randomly pick one of the available write storage locations to put the data. It will keep failing-over to any untried storage locations whenever one location is not usable.

See also
ExternalStoreFactory::getStore()
Parameters
string$data
array$paramsMap of context parameters; same as ExternalStoreFactory::getStore()
string[] | null$tryStoresBase URLs to try, e.g. [ "DB://cluster1" ]
Returns
string|bool The URL of the stored data item, or false on error
Exceptions
ExternalStoreException

Definition at line 96 of file ExternalStoreAccess.php.

◆ isReadOnly()

ExternalStoreAccess::isReadOnly (   $storeUrls = null)
Parameters
string[] | string | null$storeUrlsBase URL(s) to check, e.g. [ "DB://cluster1" ]
Returns
bool Whether all the default insertion stores are marked as read-only
Exceptions
ExternalStoreException

Definition at line 149 of file ExternalStoreAccess.php.

◆ setLogger()

ExternalStoreAccess::setLogger ( LoggerInterface  $logger)

Definition at line 37 of file ExternalStoreAccess.php.

References $logger.

Member Data Documentation

◆ $logger

LoggerInterface ExternalStoreAccess::$logger
private

Definition at line 26 of file ExternalStoreAccess.php.

Referenced by __construct(), and setLogger().

◆ $storeFactory

ExternalStoreFactory ExternalStoreAccess::$storeFactory
private

Definition at line 24 of file ExternalStoreAccess.php.


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