MediaWiki REL1_37
EtcdConfig Class Reference

Interface for configuration instances. More...

Inheritance diagram for EtcdConfig:
Collaboration diagram for EtcdConfig:

Public Member Functions

 __construct (array $params)
 
 fetchAllFromEtcd ()
 
 get ( $name)
 Get a configuration variable such as "Sitename" or "UploadMaintenance.".
 
 getModifiedIndex ()
 
 has ( $name)
 Check whether a configuration option is set for the given name.
 
 setLogger (LoggerInterface $logger)
 

Protected Member Functions

 fetchAllFromEtcdServer ( $address)
 
 parseDirectory ( $dirName, $dirNode, &$config)
 Recursively parse a directory node and populate the array passed by reference, throwing EtcdConfigParseError if there is a validation error.
 
 parseResponse ( $rbody)
 Parse a response body, throwing EtcdConfigParseError if there is a validation error.
 

Private Member Functions

 load ()
 
 unserialize ( $string)
 

Private Attributes

int $baseCacheTTL
 
string $directory
 
string $encoding
 
string $host
 
MultiHttpClient $http
 
LoggerInterface $logger
 
array $procCache
 
string $protocol
 
int $skewCacheTTL
 
BagOStuff $srvCache
 
int $timeout
 

Detailed Description

Interface for configuration instances.

Since
1.29

Definition at line 32 of file EtcdConfig.php.

Constructor & Destructor Documentation

◆ __construct()

EtcdConfig::__construct ( array  $params)
Parameters
array$paramsParameter map:
  • host: the host address and port
  • protocol: either http or https
  • directory: the etc "directory" were MediaWiki specific variables are located
  • encoding: one of ("JSON", "YAML"). Defaults to JSON. [optional]
  • cache: BagOStuff instance or ObjectFactory spec thereof for a server cache. The cache will also be used as a fallback if etcd is down. [optional]
  • cacheTTL: logical cache TTL in seconds [optional]
  • skewTTL: maximum seconds to randomly lower the assigned TTL on cache save [optional]
  • timeout: seconds to wait for etcd before throwing an error [optional]

Definition at line 69 of file EtcdConfig.php.

Member Function Documentation

◆ fetchAllFromEtcd()

EtcdConfig::fetchAllFromEtcd ( )
Returns
array (containing the keys config, error, retry, modifiedIndex)

Definition at line 214 of file EtcdConfig.php.

◆ fetchAllFromEtcdServer()

EtcdConfig::fetchAllFromEtcdServer (   $address)
protected
Parameters
string$addressHost and port
Returns
array (containing the keys config, error, retry, modifiedIndex)

Definition at line 243 of file EtcdConfig.php.

References true.

◆ get()

EtcdConfig::get (   $name)

Get a configuration variable such as "Sitename" or "UploadMaintenance.".

Parameters
string$nameName of configuration option
Returns
mixed Value configured
Exceptions
ConfigException

Implements Config.

Definition at line 114 of file EtcdConfig.php.

References load().

◆ getModifiedIndex()

EtcdConfig::getModifiedIndex ( )

Definition at line 125 of file EtcdConfig.php.

References load().

◆ has()

EtcdConfig::has (   $name)

Check whether a configuration option is set for the given name.

Parameters
string$nameName of configuration option
Returns
bool
Since
1.24

Implements Config.

Definition at line 107 of file EtcdConfig.php.

References load().

◆ load()

EtcdConfig::load ( )
private
Exceptions
ConfigException

Definition at line 134 of file EtcdConfig.php.

Referenced by get(), getModifiedIndex(), and has().

◆ parseDirectory()

EtcdConfig::parseDirectory (   $dirName,
  $dirNode,
$config 
)
protected

Recursively parse a directory node and populate the array passed by reference, throwing EtcdConfigParseError if there is a validation error.

Parameters
string$dirNameThe relative directory name
array$dirNodeThe decoded directory node
array&$configThe output array
Returns
int lastModifiedIndex The maximum last modified index across all keys in the directory

Definition at line 297 of file EtcdConfig.php.

References unserialize().

◆ parseResponse()

EtcdConfig::parseResponse (   $rbody)
protected

Parse a response body, throwing EtcdConfigParseError if there is a validation error.

Parameters
string$rbody
Returns
array

Definition at line 274 of file EtcdConfig.php.

◆ setLogger()

EtcdConfig::setLogger ( LoggerInterface  $logger)

Definition at line 102 of file EtcdConfig.php.

References $logger.

◆ unserialize()

EtcdConfig::unserialize (   $string)
private
Parameters
string$string
Returns
mixed

Definition at line 332 of file EtcdConfig.php.

Member Data Documentation

◆ $baseCacheTTL

int EtcdConfig::$baseCacheTTL
private

Definition at line 51 of file EtcdConfig.php.

◆ $directory

string EtcdConfig::$directory
private

Definition at line 47 of file EtcdConfig.php.

◆ $encoding

string EtcdConfig::$encoding
private

Definition at line 49 of file EtcdConfig.php.

◆ $host

string EtcdConfig::$host
private

Definition at line 43 of file EtcdConfig.php.

◆ $http

MultiHttpClient EtcdConfig::$http
private

Definition at line 34 of file EtcdConfig.php.

◆ $logger

LoggerInterface EtcdConfig::$logger
private

Definition at line 40 of file EtcdConfig.php.

Referenced by setLogger().

◆ $procCache

array EtcdConfig::$procCache
private

Definition at line 38 of file EtcdConfig.php.

◆ $protocol

string EtcdConfig::$protocol
private

Definition at line 45 of file EtcdConfig.php.

◆ $skewCacheTTL

int EtcdConfig::$skewCacheTTL
private

Definition at line 53 of file EtcdConfig.php.

◆ $srvCache

BagOStuff EtcdConfig::$srvCache
private

Definition at line 36 of file EtcdConfig.php.

◆ $timeout

int EtcdConfig::$timeout
private

Definition at line 55 of file EtcdConfig.php.


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