MediaWiki master
|
Helper class for tracking counterfactual file states when pre-checking file operation batches. More...
Public Member Functions | |
__construct () | |
assumeFileDoesNotExist (string $path) | |
Predicate that no file exists at the path. | |
assumeFileExists (string $path, $size, $sha1Base36) | |
Predicate that a file exists at the path. | |
resolveFileExistence (string $path, $curExistenceFunc) | |
Get the hypothetical existance a file given predicated and current state of files. | |
resolveFileSha1Base36 (string $path, $curSha1Func) | |
Get the hypothetical SHA-1 hash of a file given predicated and current state of files. | |
resolveFileSize (string $path, $curSizeFunc) | |
Get the hypothetical size of a file given predicated and current state of files. | |
snapshot (array $paths) | |
Protected Attributes | |
const | EXISTS = 'exists' |
const | SHA1 = 'sha1' |
const | SIZE = 'size' |
Helper class for tracking counterfactual file states when pre-checking file operation batches.
The file states are represented with (existence,size,sha1) triples. When combined with the current state of files in the backend, this can be used to simulate how a batch of operations would play out as a "dry run". This is used in FileBackend::doOperations() to bail out if any failure can be predicted before modifying any data. This includes file operation batches where the same file gets modified by different operations within the batch.
Definition at line 33 of file FileStatePredicates.php.
FileStatePredicates::__construct | ( | ) |
Definition at line 41 of file FileStatePredicates.php.
FileStatePredicates::assumeFileDoesNotExist | ( | string | $path | ) |
Predicate that no file exists at the path.
string | $path | Storage path |
Definition at line 65 of file FileStatePredicates.php.
References $path.
Referenced by CopyFileOp\doPrecheck(), DeleteFileOp\doPrecheck(), and MoveFileOp\doPrecheck().
FileStatePredicates::assumeFileExists | ( | string | $path, |
$size, | |||
$sha1Base36 ) |
Predicate that a file exists at the path.
string | $path | Storage path |
int | false | Closure | $size | File size or idempotent function yielding the size |
string | Closure | $sha1Base36 | File hash, or, idempotent function yielding the hash |
Definition at line 52 of file FileStatePredicates.php.
References $path.
Referenced by CopyFileOp\doPrecheck(), CreateFileOp\doPrecheck(), DescribeFileOp\doPrecheck(), MoveFileOp\doPrecheck(), and StoreFileOp\doPrecheck().
FileStatePredicates::resolveFileExistence | ( | string | $path, |
$curExistenceFunc ) |
Get the hypothetical existance a file given predicated and current state of files.
string | $path | Storage path |
Closure | $curExistenceFunc | Function to compute the current existence for a given path |
Definition at line 80 of file FileStatePredicates.php.
References $path.
Referenced by FileOp\resolveFileExistence().
FileStatePredicates::resolveFileSha1Base36 | ( | string | $path, |
$curSha1Func ) |
Get the hypothetical SHA-1 hash of a file given predicated and current state of files.
string | $path | Storage path |
Closure | $curSha1Func | Function to compute the current SHA-1 hash for a given path |
Definition at line 102 of file FileStatePredicates.php.
References $path.
Referenced by FileOp\resolveFileSha1Base36().
FileStatePredicates::resolveFileSize | ( | string | $path, |
$curSizeFunc ) |
Get the hypothetical size of a file given predicated and current state of files.
string | $path | Storage path |
Closure | $curSizeFunc | Function to compute the current size for a given path |
Definition at line 91 of file FileStatePredicates.php.
References $path.
Referenced by FileOp\resolveFileSize().
FileStatePredicates::snapshot | ( | array | $paths | ) |
string[] | $paths | List of storage paths |
Definition at line 132 of file FileStatePredicates.php.
References $path.
Referenced by FileOp\precheck().
|
protected |
Definition at line 34 of file FileStatePredicates.php.
|
protected |
Definition at line 36 of file FileStatePredicates.php.
|
protected |
Definition at line 35 of file FileStatePredicates.php.