MediaWiki  REL1_19
FileBackendMultiWrite Class Reference

This class defines a multi-write backend. More...

Inheritance diagram for FileBackendMultiWrite:
Collaboration diagram for FileBackendMultiWrite:

List of all members.

Public Member Functions

 __construct (array $config)
 Construct a proxy backend that consists of several internal backends.
 clearCache (array $paths=null)
 concatenate (array $params)
 consistencyCheck (array $paths)
 Check that a set of files are consistent across all internal backends.
 doClean (array $params)
 doPrepare (array $params)
 doSecure (array $params)
 fileExists (array $params)
 getFileContents (array $params)
 getFileList (array $params)
 getFileProps (array $params)
 getFileSha1Base36 (array $params)
 getFileSize (array $params)
 getFileStat (array $params)
 getFileTimestamp (array $params)
 getLocalCopy (array $params)
 getLocalReference (array $params)
 streamFile (array $params)

Public Attributes

const CHECK_SIZE = 1
const CHECK_TIME = 2

Protected Member Functions

 doOperationsInternal (array $ops, array $opts)
 substOpBatchPaths (array $ops, FileBackendStore $backend)
 Substitute the backend name in storage path parameters for a set of operations with that of a given internal backend.
 substOpPaths (array $ops, FileBackendStore $backend)
 Same as substOpBatchPaths() but for a single operation.
 substPaths ($paths, FileBackendStore $backend)
 Substitute the backend of storage paths with an internal backend's name.
 unsubstPaths ($paths)
 Substitute the backend of internal storage paths with the proxy backend's name.

Protected Attributes

 $backends = array()
 $masterIndex = -1
 $syncChecks = 0

Detailed Description

This class defines a multi-write backend.

Multiple backends can be registered to this proxy backend and it will act as a single backend. Use this when all access to those backends is through this proxy backend. At least one of the backends must be declared the "master" backend.

Only use this class when transitioning from one storage system to another.

Read operations are only done on the 'master' backend for consistency. Write operations are performed on all backends, in the order defined. If an operation fails on one backend it will be rolled back from the others.

Since:
1.19

Definition at line 23 of file FileBackendMultiWrite.php.


Constructor & Destructor Documentation

Construct a proxy backend that consists of several internal backends.

Additional $config params include: 'backends' : Array of backend config and multi-backend settings. Each value is the config used in the constructor of a FileBackendStore class, but with these additional settings: 'class' : The name of the backend class 'isMultiMaster' : This must be set for one backend. 'syncChecks' : Integer bitfield of internal backend sync checks to perform. Possible bits include self::CHECK_SIZE and self::CHECK_TIME. The checks are done before allowing any file operations.

Parameters:
$configArray

Reimplemented from FileBackend.

Definition at line 46 of file FileBackendMultiWrite.php.

References FileBackend\$name, and CHECK_SIZE.


Member Function Documentation

FileBackendMultiWrite::clearCache ( array $  paths = null)
See also:
FileBackend::clearCache()

Reimplemented from FileBackend.

Definition at line 414 of file FileBackendMultiWrite.php.

References substPaths().

Referenced by doOperationsInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

See also:
FileBackend::getFileList()

Reimplemented from FileBackend.

Definition at line 317 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

Check that a set of files are consistent across all internal backends.

Parameters:
$pathsArray
Returns:
Status

Definition at line 168 of file FileBackendMultiWrite.php.

References $path, Status\newGood(), substOpPaths(), and wfTimestamp().

Referenced by doOperationsInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

FileBackendMultiWrite::doClean ( array $  params)
See also:
FileBackend::doClean()

Reimplemented from FileBackend.

Definition at line 305 of file FileBackendMultiWrite.php.

References Status\newGood(), and substOpPaths().

Here is the call graph for this function:

FileBackendMultiWrite::doPrepare ( array $  params)
See also:
FileBackend::doPrepare()

Reimplemented from FileBackend.

Definition at line 281 of file FileBackendMultiWrite.php.

References Status\newGood(), and substOpPaths().

Here is the call graph for this function:

FileBackendMultiWrite::doSecure ( array $  params)
See also:
FileBackend::doSecure()

Reimplemented from FileBackend.

Definition at line 293 of file FileBackendMultiWrite.php.

References Status\newGood(), and substOpPaths().

Here is the call graph for this function:

FileBackendMultiWrite::fileExists ( array $  params)
See also:
FileBackend::fileExists()

Reimplemented from FileBackend.

Definition at line 326 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileContents()

Reimplemented from FileBackend.

Definition at line 358 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileList()

Reimplemented from FileBackend.

Definition at line 406 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileProps()

Reimplemented from FileBackend.

Definition at line 374 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileSha1Base36()

Reimplemented from FileBackend.

Definition at line 366 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileSize()

Reimplemented from FileBackend.

Definition at line 342 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileStat()

Reimplemented from FileBackend.

Definition at line 350 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getFileTimestamp()

Reimplemented from FileBackend.

Definition at line 334 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getLocalCopy()

Reimplemented from FileBackend.

Definition at line 398 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

See also:
FileBackend::getLocalReference()

Reimplemented from FileBackend.

Definition at line 390 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

FileBackendMultiWrite::streamFile ( array $  params)
See also:
FileBackend::streamFile()

Reimplemented from FileBackend.

Definition at line 382 of file FileBackendMultiWrite.php.

References substOpPaths().

Here is the call graph for this function:

FileBackendMultiWrite::substOpBatchPaths ( array $  ops,
FileBackendStore backend 
) [protected]

Substitute the backend name in storage path parameters for a set of operations with that of a given internal backend.

Parameters:
$opsArray List of file operation arrays
$backendFileBackendStore
Returns:
Array

Definition at line 223 of file FileBackendMultiWrite.php.

References substPaths().

Referenced by doOperationsInternal(), and substOpPaths().

Here is the call graph for this function:

Here is the caller graph for this function:

FileBackendMultiWrite::substOpPaths ( array $  ops,
FileBackendStore backend 
) [protected]

Same as substOpBatchPaths() but for a single operation.

Parameters:
$opFile operation array
$backendFileBackendStore
Returns:
Array

Definition at line 244 of file FileBackendMultiWrite.php.

References substOpBatchPaths().

Referenced by concatenate(), consistencyCheck(), doClean(), doPrepare(), doSecure(), fileExists(), getFileContents(), getFileList(), getFileProps(), getFileSha1Base36(), getFileSize(), getFileStat(), getFileTimestamp(), getLocalCopy(), getLocalReference(), and streamFile().

Here is the call graph for this function:

Here is the caller graph for this function:

FileBackendMultiWrite::substPaths ( paths,
FileBackendStore backend 
) [protected]

Substitute the backend of storage paths with an internal backend's name.

Parameters:
$pathsArray|string List of paths or single string path
$backendFileBackendStore
Returns:
Array|string

Definition at line 256 of file FileBackendMultiWrite.php.

References StringUtils\escapeRegexReplacement().

Referenced by clearCache(), and substOpBatchPaths().

Here is the call graph for this function:

Here is the caller graph for this function:

FileBackendMultiWrite::unsubstPaths ( paths) [protected]

Substitute the backend of internal storage paths with the proxy backend's name.

Parameters:
$pathsArray|string List of paths or single string path
Returns:
Array|string

Definition at line 270 of file FileBackendMultiWrite.php.

References StringUtils\escapeRegexReplacement().

Referenced by doOperationsInternal().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

FileBackendMultiWrite::$backends = array() [protected]

Definition at line 25 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::$masterIndex = -1 [protected]

Definition at line 26 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::$syncChecks = 0 [protected]

Definition at line 27 of file FileBackendMultiWrite.php.

Definition at line 30 of file FileBackendMultiWrite.php.

Referenced by __construct().

Definition at line 31 of file FileBackendMultiWrite.php.


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