}
/**
- * @see FileBackend::doStore()
+ * @see FileBackend::doStoreInternal()
*/
- protected function doStore( array $params ) {
+ protected function doStoreInternal( array $params ) {
$status = Status::newGood();
list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] );
}
/**
- * @see FileBackend::doCopy()
+ * @see FileBackend::doCopyInternal()
*/
- protected function doCopy( array $params ) {
+ protected function doCopyInternal( array $params ) {
$status = Status::newGood();
list( $c, $source ) = $this->resolveStoragePath( $params['src'] );
}
/**
- * @see FileBackend::doMove()
+ * @see FileBackend::doMoveInternal()
*/
- protected function doMove( array $params ) {
+ protected function doMoveInternal( array $params ) {
$status = Status::newGood();
list( $c, $source ) = $this->resolveStoragePath( $params['src'] );
}
/**
- * @see FileBackend::doDelete()
+ * @see FileBackend::doDeleteInternal()
*/
- protected function doDelete( array $params ) {
+ protected function doDeleteInternal( array $params ) {
$status = Status::newGood();
list( $c, $source ) = $this->resolveStoragePath( $params['src'] );
}
/**
- * @see FileBackend::doConcatenate()
+ * @see FileBackend::doConcatenateInternal()
*/
- protected function doConcatenate( array $params ) {
+ protected function doConcatenateInternal( array $params ) {
$status = Status::newGood();
list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] );
}
/**
- * @see FileBackend::doCreate()
+ * @see FileBackend::doCreateInternal()
*/
- protected function doCreate( array $params ) {
+ protected function doCreateInternal( array $params ) {
$status = Status::newGood();
list( $c, $dest ) = $this->resolveStoragePath( $params['dst'] );
abstract public function doOperations( array $ops, array $opts = array() );
/**
- * Same as doOperations() except it takes a single operation array
+ * Same as doOperations() except it takes a single operation.
+ * If you are doing a batch of operations that should either
+ * all succeed or all fail, then use that function instead.
*
- * @param $op Array
- * @param $opts Array
+ * @see FileBackendBase::doOperations()
+ *
+ * @param $op Array Operation
+ * @param $opts Array Operation options
* @return Status
*/
final public function doOperation( array $op, array $opts = array() ) {
return $this->doOperations( array( $op ), $opts );
}
+ /**
+ * Performs a single store operation.
+ * This sets $params['op'] to 'store' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function store( array $params, array $opts = array() ) {
+ $params['op'] = 'store';
+ return $this->doOperation( $params, $opts );
+ }
+
+ /**
+ * Performs a single copy operation.
+ * This sets $params['op'] to 'copy' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function copy( array $params, array $opts = array() ) {
+ $params['op'] = 'copy';
+ return $this->doOperation( $params, $opts );
+ }
+
+ /**
+ * Performs a single move operation.
+ * This sets $params['op'] to 'move' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function move( array $params, array $opts = array() ) {
+ $params['op'] = 'move';
+ return $this->doOperation( $params, $opts );
+ }
+
+ /**
+ * Performs a single delete operation.
+ * This sets $params['op'] to 'delete' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function delete( array $params, array $opts = array() ) {
+ $params['op'] = 'delete';
+ return $this->doOperation( $params, $opts );
+ }
+
+ /**
+ * Performs a single create operation.
+ * This sets $params['op'] to 'create' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function create( array $params, array $opts = array() ) {
+ $params['op'] = 'create';
+ return $this->doOperation( $params, $opts );
+ }
+
+ /**
+ * Performs a single concatenate operation.
+ * This sets $params['op'] to 'concatenate' and passes it to doOperation().
+ *
+ * @see FileBackendBase::doOperation()
+ *
+ * @param $params Array Operation parameters
+ * @param $opts Array Operation options
+ * @return Status
+ */
+ final public function concatenate( array $params, array $opts = array() ) {
+ $params['op'] = 'concatenate';
+ return $this->doOperation( $params, $opts );
+ }
+
/**
* Prepare a storage path for usage. This will create containers
* that don't yet exist or, on FS backends, create parent directories.
* @param $params Array
* @return Status
*/
- final public function store( array $params ) {
- $status = $this->doStore( $params );
+ final public function storeInternal( array $params ) {
+ $status = $this->doStoreInternal( $params );
$this->clearCache( array( $params['dst'] ) );
return $status;
}
/**
- * @see FileBackend::store()
+ * @see FileBackend::storeInternal()
*/
- abstract protected function doStore( array $params );
+ abstract protected function doStoreInternal( array $params );
/**
* Copy a file from one storage path to another in the backend.
* @param $params Array
* @return Status
*/
- final public function copy( array $params ) {
- $status = $this->doCopy( $params );
+ final public function copyInternal( array $params ) {
+ $status = $this->doCopyInternal( $params );
$this->clearCache( array( $params['dst'] ) );
return $status;
}
/**
- * @see FileBackend::copy()
+ * @see FileBackend::copyInternal()
*/
- abstract protected function doCopy( array $params );
+ abstract protected function doCopyInternal( array $params );
/**
* Delete a file at the storage path.
* @param $params Array
* @return Status
*/
- final public function delete( array $params ) {
- $status = $this->doDelete( $params );
+ final public function deleteInternal( array $params ) {
+ $status = $this->doDeleteInternal( $params );
$this->clearCache( array( $params['src'] ) );
return $status;
}
/**
* @see FileBackend::delete()
*/
- abstract protected function doDelete( array $params );
+ abstract protected function doDeleteInternal( array $params );
/**
* Move a file from one storage path to another in the backend.
* @param $params Array
* @return Status
*/
- final public function move( array $params ) {
- $status = $this->doMove( $params );
+ final public function moveInternal( array $params ) {
+ $status = $this->doMoveInternal( $params );
$this->clearCache( array( $params['src'], $params['dst'] ) );
return $status;
}
/**
* @see FileBackend::move()
*/
- protected function doMove( array $params ) {
+ protected function doMoveInternal( array $params ) {
// Copy source to dest
- $status = $this->backend->copy( $params );
+ $status = $this->backend->copyInternal( $params );
if ( !$status->isOK() ) {
return $status;
}
// Delete source (only fails due to races or medium going down)
- $status->merge( $this->backend->delete( array( 'src' => $params['src'] ) ) );
+ $status->merge( $this->backend->deleteInternal( array( 'src' => $params['src'] ) ) );
$status->setResult( true, $status->value ); // ignore delete() errors
return $status;
}
* @param $params Array
* @return Status
*/
- final public function concatenate( array $params ) {
- $status = $this->doConcatenate( $params );
+ final public function concatenateInternal( array $params ) {
+ $status = $this->doConcatenateInternal( $params );
$this->clearCache( array( $params['dst'] ) );
return $status;
}
/**
* @see FileBackend::concatenate()
*/
- abstract protected function doConcatenate( array $params );
+ abstract protected function doConcatenateInternal( array $params );
/**
* Create a file in the backend with the given contents.
* @param $params Array
* @return Status
*/
- final public function create( array $params ) {
- $status = $this->doCreate( $params );
+ final public function createInternal( array $params ) {
+ $status = $this->doCreateInternal( $params );
$this->clearCache( array( $params['dst'] ) );
return $status;
}
/**
* @see FileBackend::create()
*/
- abstract protected function doCreate( array $params );
+ abstract protected function doCreateInternal( array $params );
/**
* @see FileBackendBase::prepare()
'dst' => $this->params['src'],
'overwriteDest' => true
);
- $status = $this->backend->store( $params );
+ $status = $this->backend->storeInternal( $params );
if ( !$status->isOK() ) {
return $status;
}
'dst' => $this->params['dst'],
'overwriteDest' => true
);
- $status = $this->backend->store( $params );
+ $status = $this->backend->storeInternal( $params );
if ( !$status->isOK() ) {
return $status;
}
/**
* Store a file into the backend from a file on the file system.
- * Parameters similar to FileBackend::store(), which include:
+ * Parameters similar to FileBackend::storeInternal(), which include:
* src : source path on file system
* dst : destination storage path
* overwriteDest : do nothing and pass if an identical file exists at destination
}
// Store the file at the destination
if ( !$this->destSameAsSource ) {
- $status->merge( $this->backend->store( $this->params ) );
+ $status->merge( $this->backend->storeInternal( $this->params ) );
}
return $status;
}
}
// Create the file at the destination
if ( !$this->destSameAsSource ) {
- $status->merge( $this->backend->create( $this->params ) );
+ $status->merge( $this->backend->createInternal( $this->params ) );
}
return $status;
}
}
// Copy the file into the destination
if ( !$this->destSameAsSource ) {
- $status->merge( $this->backend->copy( $this->params ) );
+ $status->merge( $this->backend->copyInternal( $this->params ) );
}
return $status;
}
}
if ( !$this->destSameAsSource ) {
// Move the file into the destination
- $status->merge( $this->backend->move( $this->params ) );
+ $status->merge( $this->backend->moveInternal( $this->params ) );
} else {
// Create a source backup copy as needed
$status->merge( $this->backupSource() );
}
// Just delete source as the destination needs no changes
$params = array( 'src' => $this->params['src'] );
- $status->merge( $this->backend->delete( $params ) );
+ $status->merge( $this->backend->deleteInternal( $params ) );
if ( !$status->isOK() ) {
return $status;
}
'src' => $this->params['dst'],
'dst' => $this->params['src']
);
- $status->merge( $this->backend->move( $params ) );
+ $status->merge( $this->backend->moveInternal( $params ) );
if ( !$status->isOK() ) {
return $status; // also can't restore any dest file
}
}
}
// Concatenate the file at the destination
- $status->merge( $this->backend->concatenate( $this->params ) );
+ $status->merge( $this->backend->concatenateInternal( $this->params ) );
return $status;
}
return $status;
}
// Delete the source file
- $status->merge( $this->backend->delete( $this->params ) );
+ $status->merge( $this->backend->deleteInternal( $this->params ) );
if ( !$status->isOK() ) {
return $status;
}