* - nonJournaled : Don't log this operation batch in the file journal.
* - concurrency : Try to do this many operations in parallel when possible.
*
- * The resulting Status will be "OK" unless:
+ * The resulting StatusValue will be "OK" unless:
* - a) unexpected operation errors occurred (network partitions, disk full...)
* - b) significant operation errors occurred and 'force' was not set
*
* @param FileOp[] $performOps List of FileOp operations
* @param array $opts Batch operation options
* @param FileJournal $journal Journal to log operations to
- * @return Status
+ * @return StatusValue
*/
public static function attempt( array $performOps, array $opts, FileJournal $journal ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
$n = count( $performOps );
if ( $n > self::MAX_BATCH_SIZE ) {
if ( count( $entries ) ) {
$subStatus = $journal->logChangeBatch( $entries, $batchId );
if ( !$subStatus->isOK() ) {
- return $subStatus; // abort
+ $status->merge( $subStatus );
+
+ return $status; // abort
}
}
* This will abort remaining ops on failure.
*
* @param array $pPerformOps Batches of file ops (batches use original indexes)
- * @param Status $status
+ * @param StatusValue $status
*/
- protected static function runParallelBatches( array $pPerformOps, Status $status ) {
+ protected static function runParallelBatches( array $pPerformOps, StatusValue $status ) {
$aborted = false; // set to true on unexpected errors
foreach ( $pPerformOps as $performOpsBatch ) {
/** @var FileOp[] $performOpsBatch */
}
continue;
}
- /** @var Status[] $statuses */
+ /** @var StatusValue[] $statuses */
$statuses = [];
$opHandles = [];
// Get the backend; all sub-batch ops belong to a single backend
$backend = reset( $performOpsBatch )->getBackend();
// Get the operation handles or actually do it if there is just one.
- // If attemptAsync() returns a Status, it was either due to an error
+ // If attemptAsync() returns a StatusValue, it was either due to an error
// or the backend does not support async ops and did it synchronously.
foreach ( $performOpsBatch as $i => $fileOp ) {
if ( !isset( $status->success[$i] ) ) { // didn't already fail in precheck()