MediaWiki  1.33.0
FileOpBatch Class Reference

Helper class for representing batch file operations. More...

Static Public Member Functions

static attempt (array $performOps, array $opts, FileJournal $journal)
 Attempt to perform a series of file operations. More...
 

Public Attributes

const MAX_BATCH_SIZE = 1000
 

Static Protected Member Functions

static runParallelBatches (array $pPerformOps, StatusValue $status)
 Attempt a list of file operations sub-batches in series. More...
 

Detailed Description

Helper class for representing batch file operations.

Do not use this class from places outside FileBackend.

Methods should avoid throwing exceptions at all costs.

Since
1.20

Definition at line 33 of file FileOpBatch.php.

Member Function Documentation

◆ attempt()

static FileOpBatch::attempt ( array  $performOps,
array  $opts,
FileJournal  $journal 
)
static

Attempt to perform a series of file operations.

Callers are responsible for handling file locking.

$opts is an array of options, including:

  • force : Errors that would normally cause a rollback do not. The remaining operations are still attempted if any fail.
  • nonJournaled : Don't log this operation batch in the file journal.
  • concurrency : Try to do this many operations in parallel when possible.

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
Parameters
FileOp[]$performOpsList of FileOp operations
array$optsBatch operation options
FileJournal$journalJournal to log operations to
Returns
StatusValue

Definition at line 56 of file FileOpBatch.php.

References as, captcha-old\count, FileJournal\getTimestampedUUID(), FileJournal\logChangeBatch(), FileOp\newDependencies(), StatusValue\newGood(), FileOp\newPredicates(), and runParallelBatches().

Referenced by FileBackendStore\doOperationsInternal().

◆ runParallelBatches()

static FileOpBatch::runParallelBatches ( array  $pPerformOps,
StatusValue  $status 
)
staticprotected

Attempt a list of file operations sub-batches in series.

The operations in each sub-batch will be done in parallel. The caller is responsible for making sure the operations within any given sub-batch do not depend on each other. This will abort remaining ops on failure.

Parameters
array$pPerformOpsBatches of file ops (batches use original indexes)
StatusValue$status

Definition at line 148 of file FileOpBatch.php.

References as, and captcha-old\count.

Referenced by attempt().

Member Data Documentation

◆ MAX_BATCH_SIZE

const FileOpBatch::MAX_BATCH_SIZE = 1000

Definition at line 35 of file FileOpBatch.php.


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