[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/filebackend/ -> FileBackendStore.php (summary)

Base class for all backends using particular storage medium. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Aaron Schulz
File Size: 1957 lines (68 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

FileBackendStoreShardDirIterator:: (1 method):
  listFromShard()

FileBackendStoreShardFileIterator:: (1 method):
  listFromShard()

Defines 1 function

  __construct()
  maxFileSizeInternal()
  createInternal()
  storeInternal()
  copyInternal()
  deleteInternal()
  moveInternal()
  doMoveInternal()
  describeInternal()
  doDescribeInternal()
  nullInternal()
  concatenate()
  doConcatenate()
  doPrepare()
  doPrepareInternal()
  doSecure()
  doSecureInternal()
  doPublish()
  doPublishInternal()
  doClean()
  doCleanInternal()
  fileExists()
  getFileTimestamp()
  getFileSize()
  getFileStat()
  getFileContentsMulti()
  doGetFileContentsMulti()
  getFileXAttributes()
  doGetFileXAttributes()
  getFileSha1Base36()
  doGetFileSha1Base36()
  getFileProps()
  getLocalReferenceMulti()
  doGetLocalReferenceMulti()
  getLocalCopyMulti()
  getFileHttpUrl()
  streamFile()
  doStreamFile()
  directoryExists()
  getDirectoryList()
  getFileList()
  getOperationsInternal()
  getPathsToLockForOpsInternal()
  getScopedLocksForOps()
  doOperationsInternal()
  doQuickOperationsInternal()
  executeOpHandlesInternal()
  doExecuteOpHandlesInternal()
  stripInvalidHeadersFromOp()
  preloadCache()
  clearCache()
  doClearCache()
  preloadFileStat()
  doGetFileStatMulti()
  isValidContainerName()
  resolveStoragePath()
  resolveStoragePathReal()
  getContainerShard()
  isSingleShardPathInternal()
  getContainerHashLevels()
  getContainerSuffixes()
  fullContainerName()
  resolveContainerName()
  resolveContainerPath()
  containerCacheKey()
  setContainerCache()
  deleteContainerCache()
  primeContainerCache()
  doPrimeContainerCache()
  fileCacheKey()
  setFileCache()
  deleteFileCache()
  primeFileCache()
  normalizeXAttributes()
  setConcurrencyFlags()
  getContentType()
  closeResources()
  __construct()
  accept()
  rewind()

Class: FileBackendStoreShardDirIterator  - X-Ref

Iterator for listing directories

listFromShard( $container )   X-Ref
No description

Class: FileBackendStoreShardFileIterator  - X-Ref

Iterator for listing regular files

listFromShard( $container )   X-Ref
No description

Functions
Functions that are not part of a class:

__construct( array $config )   X-Ref

param: array $config

maxFileSizeInternal()   X-Ref
Get the maximum allowable file size given backend
medium restrictions and basic performance constraints.
Do not call this function from places outside FileBackend and FileOp.

return: int Bytes

createInternal( array $params )   X-Ref
Create a file in the backend with the given contents.
This will overwrite any file that exists at the destination.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- content     : the raw file contents
- dst         : destination storage path
- headers     : HTTP header name/value map
- async       : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.
- dstExists   : Whether a file exists at the destination (optimization).
Callers can use "false" if no existing file is being changed.

param: array $params
return: Status

storeInternal( array $params )   X-Ref
Store a file into the backend from a file on disk.
This will overwrite any file that exists at the destination.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- src         : source path on disk
- dst         : destination storage path
- headers     : HTTP header name/value map
- async       : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.
- dstExists   : Whether a file exists at the destination (optimization).
Callers can use "false" if no existing file is being changed.

param: array $params
return: Status

copyInternal( array $params )   X-Ref
Copy a file from one storage path to another in the backend.
This will overwrite any file that exists at the destination.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- src                 : source storage path
- dst                 : destination storage path
- ignoreMissingSource : do nothing if the source file does not exist
- headers             : HTTP header name/value map
- async               : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.
- dstExists           : Whether a file exists at the destination (optimization).
Callers can use "false" if no existing file is being changed.

param: array $params
return: Status

deleteInternal( array $params )   X-Ref
Delete a file at the storage path.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- src                 : source storage path
- ignoreMissingSource : do nothing if the source file does not exist
- async               : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.

param: array $params
return: Status

moveInternal( array $params )   X-Ref
Move a file from one storage path to another in the backend.
This will overwrite any file that exists at the destination.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- src                 : source storage path
- dst                 : destination storage path
- ignoreMissingSource : do nothing if the source file does not exist
- headers             : HTTP header name/value map
- async               : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.
- dstExists           : Whether a file exists at the destination (optimization).
Callers can use "false" if no existing file is being changed.

param: array $params
return: Status

doMoveInternal( array $params )   X-Ref

param: array $params
return: Status

describeInternal( array $params )   X-Ref
Alter metadata for a file at the storage path.
Do not call this function from places outside FileBackend and FileOp.

$params include:
- src           : source storage path
- headers       : HTTP header name/value map
- async         : Status will be returned immediately if supported.
If the status is OK, then its value field will be
set to a FileBackendStoreOpHandle object.

param: array $params
return: Status

doDescribeInternal( array $params )   X-Ref

param: array $params
return: Status

nullInternal( array $params )   X-Ref
No-op file operation that does nothing.
Do not call this function from places outside FileBackend and FileOp.

param: array $params
return: Status

concatenate( array $params )   X-Ref
No description

doConcatenate( array $params )   X-Ref

param: array $params
return: Status

doPrepare( array $params )   X-Ref
No description

doPrepareInternal( $container, $dir, array $params )   X-Ref

param: string $container
param: string $dir
param: array $params
return: Status

doSecure( array $params )   X-Ref
No description

doSecureInternal( $container, $dir, array $params )   X-Ref

param: string $container
param: string $dir
param: array $params
return: Status

doPublish( array $params )   X-Ref
No description

doPublishInternal( $container, $dir, array $params )   X-Ref

param: string $container
param: string $dir
param: array $params
return: Status

doClean( array $params )   X-Ref
No description

doCleanInternal( $container, $dir, array $params )   X-Ref

param: string $container
param: string $dir
param: array $params
return: Status

fileExists( array $params )   X-Ref
No description

getFileTimestamp( array $params )   X-Ref
No description

getFileSize( array $params )   X-Ref
No description

getFileStat( array $params )   X-Ref
No description

getFileContentsMulti( array $params )   X-Ref


doGetFileContentsMulti( array $params )   X-Ref

param: array $params
return: array

getFileXAttributes( array $params )   X-Ref
No description

doGetFileXAttributes( array $params )   X-Ref

return: bool|string

getFileSha1Base36( array $params )   X-Ref
No description

doGetFileSha1Base36( array $params )   X-Ref

param: array $params
return: bool|string

getFileProps( array $params )   X-Ref
No description

getLocalReferenceMulti( array $params )   X-Ref
No description

doGetLocalReferenceMulti( array $params )   X-Ref

param: array $params
return: array

getLocalCopyMulti( array $params )   X-Ref
No description

getFileHttpUrl( array $params )   X-Ref

param: array $params
return: string|null

streamFile( array $params )   X-Ref
No description

doStreamFile( array $params )   X-Ref

param: array $params
return: Status

directoryExists( array $params )   X-Ref
No description

getDirectoryList( array $params )   X-Ref

param: string $container Resolved container name
param: string $dir Resolved path relative to container
param: array $params
return: bool|null

getFileList( array $params )   X-Ref
Do not call this function from places outside FileBackend

param: string $container Resolved container name
param: string $dir Resolved path relative to container
param: array $params
return: Traversable|array|null Returns null on failure

getOperationsInternal( array $ops )   X-Ref
Return a list of FileOp objects from a list of operations.
Do not call this function from places outside FileBackend.

The result must have the same number of items as the input.
An exception is thrown if an unsupported operation is requested.

param: array $ops Same format as doOperations()
return: array List of FileOp objects

getPathsToLockForOpsInternal( array $performOps )   X-Ref
Get a list of storage paths to lock for a list of operations
Returns an array with LockManager::LOCK_UW (shared locks) and
LockManager::LOCK_EX (exclusive locks) keys, each corresponding
to a list of storage paths to be locked. All returned paths are
normalized.

param: array $performOps List of FileOp objects
return: array (LockManager::LOCK_UW => path list, LockManager::LOCK_EX => path list)

getScopedLocksForOps( array $ops, Status $status )   X-Ref
No description

doOperationsInternal( array $ops, array $opts )   X-Ref
No description

doQuickOperationsInternal( array $ops )   X-Ref
No description

executeOpHandlesInternal( array $fileOpHandles )   X-Ref
Execute a list of FileBackendStoreOpHandle handles in parallel.
The resulting Status object fields will correspond
to the order in which the handles where given.

param: array $fileOpHandles
return: array Map of Status objects

doExecuteOpHandlesInternal( array $fileOpHandles )   X-Ref

param: array $fileOpHandles
return: array List of corresponding Status objects

stripInvalidHeadersFromOp( array $op )   X-Ref
Strip long HTTP headers from a file operation.
Most headers are just numbers, but some are allowed to be long.
This function is useful for cleaning up headers and avoiding backend
specific errors, especially in the middle of batch file operations.

param: array $op Same format as doOperation()
return: array

preloadCache( array $paths )   X-Ref
No description

clearCache( array $paths = null )   X-Ref
No description

doClearCache( array $paths = null )   X-Ref
Clears any additional stat caches for storage paths

param: array $paths Storage paths (optional)

preloadFileStat( array $params )   X-Ref
No description

doGetFileStatMulti( array $params )   X-Ref
Get file stat information (concurrently if possible) for several files

param: array $params Parameters include:
return: array|null Map of storage paths to array|bool|null (returns null if not supported)

isValidContainerName( $container )   X-Ref
Check if a container name is valid.
This checks for for length and illegal characters.

param: string $container
return: bool

resolveStoragePath( $storagePath )   X-Ref
Splits a storage path into an internal container name,
an internal relative file name, and a container shard suffix.
Any shard suffix is already appended to the internal container name.
This also checks that the storage path is valid and within this backend.

If the container is sharded but a suffix could not be determined,
this means that the path can only refer to a directory and can only
be scanned by looking in all the container shards.

param: string $storagePath
return: array (container, path, container suffix) or (null, null, null) if invalid

resolveStoragePathReal( $storagePath )   X-Ref
Like resolveStoragePath() except null values are returned if
the container is sharded and the shard could not be determined
or if the path ends with '/'. The later case is illegal for FS
backends and can confuse listings for object store backends.

This function is used when resolving paths that must be valid
locations for files. Directory and listing functions should
generally just use resolveStoragePath() instead.

param: string $storagePath
return: array (container, path) or (null, null) if invalid

getContainerShard( $container, $relPath )   X-Ref
Get the container name shard suffix for a given path.
Any empty suffix means the container is not sharded.

param: string $container Container name
param: string $relPath Storage path relative to the container
return: string|null Returns null if shard could not be determined

isSingleShardPathInternal( $storagePath )   X-Ref
Check if a storage path maps to a single shard.
Container dirs like "a", where the container shards on "x/xy",
can reside on several shards. Such paths are tricky to handle.

param: string $storagePath Storage path
return: bool

getContainerHashLevels( $container )   X-Ref
Get the sharding config for a container.
If greater than 0, then all file storage paths within
the container are required to be hashed accordingly.

param: string $container
return: array (integer levels, integer base, repeat flag) or (0, 0, false)

getContainerSuffixes( $container )   X-Ref
Get a list of full container shard suffixes for a container

param: string $container
return: array

fullContainerName( $container )   X-Ref
Get the full container name, including the wiki ID prefix

param: string $container
return: string

resolveContainerName( $container )   X-Ref
Resolve a container name, checking if it's allowed by the backend.
This is intended for internal use, such as encoding illegal chars.
Subclasses can override this to be more restrictive.

param: string $container
return: string|null

resolveContainerPath( $container, $relStoragePath )   X-Ref
Resolve a relative storage path, checking if it's allowed by the backend.
This is intended for internal use, such as encoding illegal chars or perhaps
getting absolute paths (e.g. FS based backends). Note that the relative path
may be the empty string (e.g. the path is simply to the container).

param: string $container Container name
param: string $relStoragePath Storage path relative to the container
return: string|null Path or null if not valid

containerCacheKey( $container )   X-Ref
Get the cache key for a container

param: string $container Resolved container name
return: string

setContainerCache( $container, array $val )   X-Ref
Set the cached info for a container

param: string $container Resolved container name
param: array $val Information to cache

deleteContainerCache( $container )   X-Ref
Delete the cached info for a container.
The cache key is salted for a while to prevent race conditions.

param: string $container Resolved container name

primeContainerCache( array $items )   X-Ref
Do a batch lookup from cache for container stats for all containers
used in a list of container names or storage paths objects.
This loads the persistent cache values into the process cache.

param: array $items

doPrimeContainerCache( array $containerInfo )   X-Ref
Fill the backend-specific process cache given an array of
resolved container names and their corresponding cached info.
Only containers that actually exist should appear in the map.

param: array $containerInfo Map of resolved container names to cached info

fileCacheKey( $path )   X-Ref
Get the cache key for a file path

param: string $path Normalized storage path
return: string

setFileCache( $path, array $val )   X-Ref
Set the cached stat info for a file path.
Negatives (404s) are not cached. By not caching negatives, we can skip cache
salting for the case when a file is created at a path were there was none before.

param: string $path Storage path
param: array $val Stat information to cache

deleteFileCache( $path )   X-Ref
No description

primeFileCache( array $items )   X-Ref
Do a batch lookup from cache for file stats for all paths
used in a list of storage paths or FileOp objects.
This loads the persistent cache values into the process cache.

param: array $items List of storage paths

normalizeXAttributes( array $xattr )   X-Ref
Normalize file headers/metadata to the FileBackend::getFileXAttributes() format

param: array $xattr
return: array

setConcurrencyFlags( array $opts )   X-Ref
Set the 'concurrency' option from a list of operation options

param: array $opts Map of operation options
return: array

getContentType( $storagePath, $content, $fsPath )   X-Ref
Get the content type to use in HEAD/GET requests for a file

param: string $storagePath
param: string|null $content File data
param: string|null $fsPath File system path
return: string MIME type

closeResources()   X-Ref
Close all open file handles


__construct(FileBackendStore $backend, $container, $dir, array $suffixes, array $params)   X-Ref

param: FileBackendStore $backend
param: string $container Full storage container name
param: string $dir Storage directory relative to container
param: array $suffixes List of container shard suffixes
param: array $params

accept()   X-Ref
No description

rewind()   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1