MediaWiki  REL1_21
FileBackendMultiWrite Class Reference

Proxy backend that mirrors writes to several internal backends. 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.
 accessibilityCheck (array $paths)
 Check that a set of file paths are usable across all internal backends.
 clearCache (array $paths=null)
 concatenate (array $params)
 consistencyCheck (array $paths)
 Check that a set of files are consistent across all internal backends.
 directoryExists (array $params)
 fileExists (array $params)
 getDirectoryList (array $params)
 getFileContentsMulti (array $params)
 getFileHttpUrl (array $params)
 getFileList (array $params)
 getFileProps (array $params)
 getFileSha1Base36 (array $params)
 getFileSize (array $params)
 getFileStat (array $params)
 getFileTimestamp (array $params)
 getLocalCopyMulti (array $params)
 getLocalReferenceMulti (array $params)
 getScopedLocksForOps (array $ops, Status $status)
 resyncFiles (array $paths)
 Check that a set of files are consistent across all internal backends and re-synchronize those files againt the "multi master" if needed.
 streamFile (array $params)

Public Attributes

const CHECK_SHA1 = 4
const CHECK_SIZE = 1
const CHECK_TIME = 2

Protected Member Functions

 doClean (array $params)
 doOperationsInternal (array $ops, array $opts)
 doPrepare (array $params)
 doPublish (array $params)
 doQuickOperationsInternal (array $ops)
 doSecure (array $params)
 fileStoragePathsForOps (array $ops)
 Get a list of file storage paths to read or write for a list of operations.
 replicateContainerDirChanges ($path)
 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

 $autoResync = false
Array $backends = array()
 Prioritized list of FileBackendStore objects *.
 $masterIndex = -1
Array $noPushDirConts = array()
 *
 $noPushQuickOps = false
 $syncChecks = 0

Detailed Description

Proxy backend that mirrors writes to several internal backends.

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 42 of file FileBackendMultiWrite.php.


Constructor & Destructor Documentation

Construct a proxy backend that consists of several internal backends.

Locking, journaling, and read-only checks are handled by the proxy backend.

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.
    • template: : If given a backend name, this will use the config of that backend as a template. Values specified here take precedence.
  • syncChecks : Integer bitfield of internal backend sync checks to perform. Possible bits include the FileBackendMultiWrite::CHECK_* constants. There are constants for SIZE, TIME, and SHA1. The checks are done before allowing any file operations.
  • autoResync : Automatically resync the clone backends to the master backend when pre-operation sync checks fail. This should only be used if the master backend is stable and not missing any files.
  • noPushQuickOps : (hack) Only apply doQuickOperations() to the master backend.
  • noPushDirConts : (hack) Only apply directory functions to the master backend.
Parameters:
$configArray
Exceptions:
MWException

Reimplemented from FileBackend.

Definition at line 82 of file FileBackendMultiWrite.php.


Member Function Documentation

Check that a set of file paths are usable across all internal backends.

Parameters:
array$pathsList of storage paths
Returns:
Status

Definition at line 274 of file FileBackendMultiWrite.php.

See also:
FileBackend::clearCache()

Reimplemented from FileBackend.

Definition at line 700 of file FileBackendMultiWrite.php.

See also:
FileBackend::concatenate()
Parameters:
$paramsarray
Returns:
Status

Reimplemented from FileBackend.

Definition at line 534 of file FileBackendMultiWrite.php.

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

Parameters:
array$pathsList of storage paths
Returns:
Status

Definition at line 208 of file FileBackendMultiWrite.php.

See also:
FileBackend::directoryExists()
Parameters:
$paramsarray
Returns:
bool|null

Reimplemented from FileBackend.

Definition at line 672 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::doClean ( array params) [protected]
See also:
FileBackend::doClean()
Parameters:
$paramsarray
Returns:
Status

Reimplemented from FileBackend.

Definition at line 517 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::doOperationsInternal ( array ops,
array opts 
) [final, protected]
See also:
FileBackend::doOperationsInternal()
Returns:
Status

Reimplemented from FileBackend.

Definition at line 136 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::doPrepare ( array params) [protected]
See also:
FileBackend::doPrepare()
Returns:
Status

Reimplemented from FileBackend.

Definition at line 466 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::doPublish ( array params) [protected]
See also:
FileBackend::doPublish()
Parameters:
$paramsarray
Returns:
Status

Reimplemented from FileBackend.

Definition at line 500 of file FileBackendMultiWrite.php.

See also:
FileBackend::doQuickOperationsInternal()
Returns:
Status

Reimplemented from FileBackend.

Definition at line 429 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::doSecure ( array params) [protected]
See also:
FileBackend::doSecure()
Parameters:
$paramsarray
Returns:
Status

Reimplemented from FileBackend.

Definition at line 483 of file FileBackendMultiWrite.php.

See also:
FileBackend::fileExists()
Parameters:
$paramsarray
Returns:
bool|null

Reimplemented from FileBackend.

Definition at line 545 of file FileBackendMultiWrite.php.

Get a list of file storage paths to read or write for a list of operations.

Parameters:
array$opsSame format as doOperations()
Returns:
Array List of storage paths to files (does not include directories)

Definition at line 340 of file FileBackendMultiWrite.php.

See also:
FileBackend::getSubdirectoryList()
Parameters:
$paramsarray
Returns:
Array|null|Traversable

Reimplemented from FileBackend.

Definition at line 682 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileContentsMulti()
Parameters:
$paramsarray
Returns:
bool|string

Reimplemented from FileBackend.

Definition at line 585 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileHttpUrl()
Returns:
string|null

Reimplemented from FileBackend.

Definition at line 662 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileList()
Parameters:
$paramsarray
Returns:
Array|null|

Reimplemented from FileBackend.

Definition at line 692 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileProps()
Parameters:
$paramsarray
Returns:
Array

Reimplemented from FileBackend.

Definition at line 611 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileSha1Base36()
Parameters:
$paramsarray
Returns:
bool|string

Reimplemented from FileBackend.

Definition at line 601 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileSize()
Parameters:
$paramsarray
Returns:
bool|int

Reimplemented from FileBackend.

Definition at line 565 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileStat()
Parameters:
$paramsarray
Returns:
Array|bool|null

Reimplemented from FileBackend.

Definition at line 575 of file FileBackendMultiWrite.php.

See also:
FileBackend::getFileTimestamp()
Parameters:
$paramsarray
Returns:
bool|string

Reimplemented from FileBackend.

Definition at line 555 of file FileBackendMultiWrite.php.

See also:
FileBackend::getLocalCopyMulti()
Parameters:
$paramsarray
Returns:
null|TempFSFile

Reimplemented from FileBackend.

Definition at line 647 of file FileBackendMultiWrite.php.

See also:
FileBackend::getLocalReferenceMulti()
Parameters:
$paramsarray
Returns:
FSFile|null

Reimplemented from FileBackend.

Definition at line 631 of file FileBackendMultiWrite.php.

See also:
FileBackend::getScopedLocksForOps()

Reimplemented from FileBackend.

Definition at line 710 of file FileBackendMultiWrite.php.

Parameters:
string$pathStorage path
Returns:
bool Path container should have dir changes pushed to all backends

Definition at line 457 of file FileBackendMultiWrite.php.

Check that a set of files are consistent across all internal backends and re-synchronize those files againt the "multi master" if needed.

Parameters:
array$pathsList of storage paths
Returns:
Status

Definition at line 299 of file FileBackendMultiWrite.php.

See also:
FileBackend::streamFile()
Parameters:
$paramsarray
Returns:

Reimplemented from FileBackend.

Definition at line 621 of file FileBackendMultiWrite.php.

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:
array$opsList of file operation arrays
$backendFileBackendStore
Returns:
Array

Definition at line 370 of file FileBackendMultiWrite.php.

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

Same as substOpBatchPaths() but for a single operation.

Parameters:
array$opsFile operation array
$backendFileBackendStore
Returns:
Array

Definition at line 391 of file FileBackendMultiWrite.php.

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

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

Parameters:
array | string$pathsList of paths or single string path
$backendFileBackendStore
Returns:
Array|string

Definition at line 403 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::unsubstPaths ( paths) [protected]

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

Parameters:
array | string$pathsList of paths or single string path
Returns:
Array|string

Definition at line 417 of file FileBackendMultiWrite.php.


Member Data Documentation

FileBackendMultiWrite::$autoResync = false [protected]

Definition at line 46 of file FileBackendMultiWrite.php.

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

Prioritized list of FileBackendStore objects *.

Definition at line 43 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::$masterIndex = -1 [protected]

Definition at line 44 of file FileBackendMultiWrite.php.

Array FileBackendMultiWrite::$noPushDirConts = array() [protected]

*

Definition at line 48 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::$noPushQuickOps = false [protected]

Definition at line 49 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::$syncChecks = 0 [protected]

Definition at line 45 of file FileBackendMultiWrite.php.

Definition at line 54 of file FileBackendMultiWrite.php.

Definition at line 52 of file FileBackendMultiWrite.php.

Definition at line 53 of file FileBackendMultiWrite.php.


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