MediaWiki  REL1_20
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)
 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)
 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:
$pathsArray List of storage paths
Returns:
Status

Definition at line 273 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 665 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 527 of file FileBackendMultiWrite.php.

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

Parameters:
$pathsArray List of storage paths
Returns:
Status

Definition at line 207 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 637 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 510 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 459 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 493 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 422 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 476 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 537 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::fileStoragePathsForOps ( array $  ops) [protected]

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

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

Definition at line 339 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 647 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 577 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 657 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 597 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 587 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 557 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 567 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 547 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 627 of file FileBackendMultiWrite.php.

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

Reimplemented from FileBackend.

Definition at line 617 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::getScopedLocksForOps ( array $  ops,
Status status 
)
See also:
FileBackend::getScopedLocksForOps()

Reimplemented from FileBackend.

Definition at line 675 of file FileBackendMultiWrite.php.

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

Definition at line 450 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:
$pathsArray List of storage paths
Returns:
Status

Definition at line 298 of file FileBackendMultiWrite.php.

FileBackendMultiWrite::streamFile ( array $  params)
See also:
FileBackend::streamFile()
Parameters:
$paramsarray
Returns:

Reimplemented from FileBackend.

Definition at line 607 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:
$opsArray List of file operation arrays
$backendFileBackendStore
Returns:
Array

Definition at line 363 of file FileBackendMultiWrite.php.

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

Same as substOpBatchPaths() but for a single operation.

Parameters:
$opsarray File operation array
$backendFileBackendStore
Returns:
Array

Definition at line 384 of file FileBackendMultiWrite.php.

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

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 410 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: