MediaWiki
REL1_24
|
Class for an OpenStack Swift (or Ceph RGW) based file backend. More...
Public Member Functions | |
__construct (array $config) | |
getDirectoryListInternal ($fullCont, $dir, array $params) | |
getDirListPageInternal ($fullCont, $dir, &$after, $limit, array $params) | |
Do not call this function outside of SwiftFileBackendFileList. | |
getFeatures () | |
Get the a bitfield of extra features supported by the backend medium. | |
getFileHttpUrl (array $params) | |
getFileListInternal ($fullCont, $dir, array $params) | |
getFileListPageInternal ($fullCont, $dir, &$after, $limit, array $params) | |
Do not call this function outside of SwiftFileBackendFileList. | |
isPathUsableInternal ($storagePath) | |
Check if a file can be created or changed at a given storage path. | |
loadListingStatInternal ($path, array $val) | |
Do not call this function outside of SwiftFileBackendFileList. | |
onError ($status, $func, array $params, $err= '', $code=0, $desc= '') | |
Log an unexpected exception for this backend. | |
Protected Member Functions | |
addMissingMetadata (array $objHdrs, $path) | |
Fill in any missing object metadata and save it to Swift. | |
authTokenHeaders (array $creds) | |
convertSwiftDate ($ts, $format=TS_MW) | |
Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT"/"2013-05-11T07:37:27.678360Z". | |
createContainer ($container, array $params) | |
Create a Swift container. | |
deleteContainer ($container, array $params) | |
Delete a Swift container. | |
directoriesAreVirtual () | |
Is this a key/value store where directories are just virtual? Virtual directories exists in so much as files exists that are prefixed with the directory path followed by a forward slash. | |
doCleanInternal ($fullCont, $dir, array $params) | |
doCopyInternal (array $params) | |
doCreateInternal (array $params) | |
doDeleteInternal (array $params) | |
doDescribeInternal (array $params) | |
doDirectoryExists ($fullCont, $dir, array $params) | |
doExecuteOpHandlesInternal (array $fileOpHandles) | |
doGetFileContentsMulti (array $params) | |
doGetFileSha1base36 (array $params) | |
doGetFileStat (array $params) | |
doGetFileStatMulti (array $params) | |
Get file stat information (concurrently if possible) for several files. | |
doGetFileXAttributes (array $params) | |
doGetLocalCopyMulti (array $params) | |
doMoveInternal (array $params) | |
doPrepareInternal ($fullCont, $dir, array $params) | |
doPrimeContainerCache (array $containerInfo) | |
Fill the backend-specific process cache given an array of resolved container names and their corresponding cached info. | |
doPublishInternal ($fullCont, $dir, array $params) | |
doSecureInternal ($fullCont, $dir, array $params) | |
doStoreInternal (array $params) | |
doStreamFile (array $params) | |
getAuthentication () | |
getContainerStat ($container, $bypassCache=false) | |
Get a Swift container stat array, possibly from process cache. | |
headersFromParams (array $params) | |
Get headers to send to Swift when reading a file based on a FileBackend params array, e.g. | |
resolveContainerPath ($container, $relStoragePath) | |
Resolve a relative storage path, checking if it's allowed by the backend. | |
sanitizeHdrs (array $params) | |
Sanitize and filter the custom headers from a $params array. | |
setContainerAccess ($container, array $readGrps, array $writeGrps) | |
Set read/write permissions for a Swift container. | |
storageUrl (array $creds, $container=null, $object=null) | |
Protected Attributes | |
array | $authCreds |
* | |
int | $authErrorTimestamp = null |
UNIX timestamp *. | |
int | $authSessionTimestamp = 0 |
UNIX timestamp *. | |
int | $authTTL |
TTL in seconds *. | |
ProcessCacheLRU | $containerStatCache |
Container stat cache *. | |
MultiHttpClient | $http |
* | |
bool | $isRGW = false |
Whether the server is an Ceph RGW *. | |
string | $rgwS3AccessKey |
S3 access key (RADOS Gateway) *. | |
string | $rgwS3SecretKey |
S3 authentication key (RADOS Gateway) *. | |
BagOStuff | $srvCache |
* | |
string | $swiftAuthUrl |
Authentication base URL (without version) *. | |
string | $swiftKey |
Secret key for user *. | |
string | $swiftTempUrlKey |
Shared secret value for making temp URLs *. | |
string | $swiftUser |
Swift user (account:user) to authenticate as *. | |
Private Member Functions | |
buildFileObjectListing (array $params, $dir, array $objects) | |
Build a list of file objects, filtering out any directories and extracting any stat info if provided in $objects (for CF_Objects) | |
getCredsCacheKey ($username) | |
Get the cache key for a container. | |
objectListing ($fullCont, $type, $limit, $after=null, $prefix=null, $delim=null) | |
Get a list of objects under a container. |
Class for an OpenStack Swift (or Ceph RGW) based file backend.
Status messages should avoid mentioning the Swift account name. Likewise, error suppression should be used to avoid path disclosure.
Definition at line 35 of file SwiftFileBackend.php.
SwiftFileBackend::__construct | ( | array $ | config | ) |
Reimplemented from FileBackendStore.
Definition at line 92 of file SwiftFileBackend.php.
SwiftFileBackend::addMissingMetadata | ( | array $ | objHdrs, |
$ | path | ||
) | [protected] |
Fill in any missing object metadata and save it to Swift.
array | $objHdrs | Object response headers |
string | $path | Storage path to object |
Definition at line 644 of file SwiftFileBackend.php.
SwiftFileBackend::authTokenHeaders | ( | array $ | creds | ) | [protected] |
array | $creds | From getAuthentication() |
Definition at line 1613 of file SwiftFileBackend.php.
SwiftFileBackend::buildFileObjectListing | ( | array $ | params, |
$ | dir, | ||
array $ | objects | ||
) | [private] |
Build a list of file objects, filtering out any directories and extracting any stat info if provided in $objects (for CF_Objects)
array | $params | Parameters for getDirectoryList() |
string | $dir | Resolved container directory path |
array | $objects | List of CF_Object items or object names |
Definition at line 911 of file SwiftFileBackend.php.
SwiftFileBackend::convertSwiftDate | ( | $ | ts, |
$ | format = TS_MW |
||
) | [protected] |
Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT"/"2013-05-11T07:37:27.678360Z".
Dates might also come in like "2013-05-11T07:37:27.678360" from Swift listings, missing the timezone suffix (though Ceph RGW does not appear to have this bug).
string | $ts | |
int | $format | Output format (TS_* constant) |
FileBackendError |
Definition at line 627 of file SwiftFileBackend.php.
SwiftFileBackend::createContainer | ( | $ | container, |
array $ | params | ||
) | [protected] |
Create a Swift container.
string | $container | Container name |
array | $params |
Definition at line 1308 of file SwiftFileBackend.php.
SwiftFileBackend::deleteContainer | ( | $ | container, |
array $ | params | ||
) | [protected] |
Delete a Swift container.
string | $container | Container name |
array | $params |
Definition at line 1353 of file SwiftFileBackend.php.
SwiftFileBackend::directoriesAreVirtual | ( | ) | [protected] |
Is this a key/value store where directories are just virtual? Virtual directories exists in so much as files exists that are prefixed with the directory path followed by a forward slash.
Reimplemented from FileBackendStore.
Definition at line 1129 of file SwiftFileBackend.php.
SwiftFileBackend::doCleanInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 582 of file SwiftFileBackend.php.
SwiftFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 310 of file SwiftFileBackend.php.
SwiftFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 199 of file SwiftFileBackend.php.
SwiftFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 419 of file SwiftFileBackend.php.
SwiftFileBackend::doDescribeInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 460 of file SwiftFileBackend.php.
SwiftFileBackend::doDirectoryExists | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | Resolved container name |
string | $dir | Resolved path relative to container |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 734 of file SwiftFileBackend.php.
SwiftFileBackend::doExecuteOpHandlesInternal | ( | array $ | fileOpHandles | ) | [protected] |
array | $fileOpHandles |
FileBackendError |
Reimplemented from FileBackendStore.
Definition at line 1150 of file SwiftFileBackend.php.
SwiftFileBackend::doGetFileContentsMulti | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 685 of file SwiftFileBackend.php.
SwiftFileBackend::doGetFileSha1base36 | ( | array $ | params | ) | [protected] |
Definition at line 961 of file SwiftFileBackend.php.
SwiftFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 609 of file SwiftFileBackend.php.
SwiftFileBackend::doGetFileStatMulti | ( | array $ | params | ) | [protected] |
Get file stat information (concurrently if possible) for several files.
array | $params | Parameters include:
|
Reimplemented from FileBackendStore.
Definition at line 1451 of file SwiftFileBackend.php.
SwiftFileBackend::doGetFileXAttributes | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 946 of file SwiftFileBackend.php.
SwiftFileBackend::doGetLocalCopyMulti | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 1012 of file SwiftFileBackend.php.
SwiftFileBackend::doMoveInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 359 of file SwiftFileBackend.php.
SwiftFileBackend::doPrepareInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 517 of file SwiftFileBackend.php.
SwiftFileBackend::doPrimeContainerCache | ( | array $ | containerInfo | ) | [protected] |
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.
array | $containerInfo | Map of resolved container names to cached info |
Reimplemented from FileBackendStore.
Definition at line 1445 of file SwiftFileBackend.php.
SwiftFileBackend::doPublishInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 562 of file SwiftFileBackend.php.
SwiftFileBackend::doSecureInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 539 of file SwiftFileBackend.php.
SwiftFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 247 of file SwiftFileBackend.php.
SwiftFileBackend::doStreamFile | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 976 of file SwiftFileBackend.php.
SwiftFileBackend::getAuthentication | ( | ) | [protected] |
Definition at line 1533 of file SwiftFileBackend.php.
SwiftFileBackend::getContainerStat | ( | $ | container, |
$ | bypassCache = false |
||
) | [protected] |
Get a Swift container stat array, possibly from process cache.
Use $reCache if the file count or byte count is needed.
string | $container | Container name |
bool | $bypassCache | Bypass all caches and load from Swift |
Definition at line 1255 of file SwiftFileBackend.php.
SwiftFileBackend::getCredsCacheKey | ( | $ | username | ) | [private] |
Get the cache key for a container.
string | $username |
Definition at line 1623 of file SwiftFileBackend.php.
SwiftFileBackend::getDirectoryListInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) |
string | $fullCont | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 751 of file SwiftFileBackend.php.
SwiftFileBackend::getDirListPageInternal | ( | $ | fullCont, |
$ | dir, | ||
&$ | after, | ||
$ | limit, | ||
array $ | params | ||
) |
Do not call this function outside of SwiftFileBackendFileList.
string | $fullCont | Resolved container name |
string | $dir | Resolved storage directory with no trailing slash |
string | null | $after | Resolved container relative path to list items after |
int | $limit | Max number of items to list |
array | $params | Parameters for getDirectoryList() |
FileBackendError |
Definition at line 777 of file SwiftFileBackend.php.
Get the a bitfield of extra features supported by the backend medium.
Reimplemented from FileBackend.
Definition at line 134 of file SwiftFileBackend.php.
References wfGetMainCache().
SwiftFileBackend::getFileHttpUrl | ( | array $ | params | ) |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 1075 of file SwiftFileBackend.php.
SwiftFileBackend::getFileListInternal | ( | $ | fullCont, |
$ | dir, | ||
array $ | params | ||
) |
string | $fullCont | |
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 762 of file SwiftFileBackend.php.
SwiftFileBackend::getFileListPageInternal | ( | $ | fullCont, |
$ | dir, | ||
&$ | after, | ||
$ | limit, | ||
array $ | params | ||
) |
Do not call this function outside of SwiftFileBackendFileList.
string | $fullCont | Resolved container name |
string | $dir | Resolved storage directory with no trailing slash |
string | null | $after | Resolved container relative path of file to list items after |
int | $limit | Max number of items to list |
array | $params | Parameters for getDirectoryList() |
FileBackendError |
Definition at line 857 of file SwiftFileBackend.php.
SwiftFileBackend::headersFromParams | ( | array $ | params | ) | [protected] |
Get headers to send to Swift when reading a file based on a FileBackend params array, e.g.
that of getLocalCopy(). $params is currently only checked for a 'latest' flag.
array | $params |
Definition at line 1141 of file SwiftFileBackend.php.
SwiftFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Check if a file can be created or changed at a given storage path.
FS backends should check if the parent directory exists, files can be written under it, and that any file already there is writable. Backends using key/value stores should check if the container exists.
string | $storagePath |
Reimplemented from FileBackendStore.
Definition at line 149 of file SwiftFileBackend.php.
SwiftFileBackend::loadListingStatInternal | ( | $ | path, |
array $ | val | ||
) |
Do not call this function outside of SwiftFileBackendFileList.
string | $path | Storage path |
array | $val | Stat value |
Definition at line 942 of file SwiftFileBackend.php.
SwiftFileBackend::objectListing | ( | $ | fullCont, |
$ | type, | ||
$ | limit, | ||
$ | after = null , |
||
$ | prefix = null , |
||
$ | delim = null |
||
) | [private] |
Get a list of objects under a container.
Either just the names or a list of stdClass objects with details can be returned.
string | $fullCont | |
string | $type | ('info' for a list of object detail maps, 'names' for names only) |
int | $limit | |
string | null | $after | |
string | null | $prefix | |
string | null | $delim |
Definition at line 1394 of file SwiftFileBackend.php.
SwiftFileBackend::onError | ( | $ | status, |
$ | func, | ||
array $ | params, | ||
$ | err = '' , |
||
$ | code = 0 , |
||
$ | desc = '' |
||
) |
Log an unexpected exception for this backend.
This also sets the Status object to have a fatal error.
Status | null | $status | |
string | $func | |
array | $params | |
string | $err | Error string |
int | $code | HTTP status |
string | $desc | HTTP status description |
Definition at line 1638 of file SwiftFileBackend.php.
SwiftFileBackend::resolveContainerPath | ( | $ | container, |
$ | relStoragePath | ||
) | [protected] |
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).
string | $container | Container name |
string | $relStoragePath | Storage path relative to the container |
Reimplemented from FileBackendStore.
Definition at line 139 of file SwiftFileBackend.php.
References array(), and ObjectCache\newAccelerator().
SwiftFileBackend::sanitizeHdrs | ( | array $ | params | ) | [protected] |
Sanitize and filter the custom headers from a $params array.
We only allow certain Content- and X-Content- headers.
array | $params |
Definition at line 165 of file SwiftFileBackend.php.
SwiftFileBackend::setContainerAccess | ( | $ | container, |
array $ | readGrps, | ||
array $ | writeGrps | ||
) | [protected] |
Set read/write permissions for a Swift container.
In general, we don't allow listings to end-users. It's not useful, isn't well-defined (lists are truncated to 10000 item with no way to page), and is just a performance risk.
string | $container | Resolved Swift container |
array | $readGrps | List of the possible criteria for a request to have access to read a container. Each item is one of the following formats:
|
array | $writeGrps | A list of the possible criteria for a request to have access to write to a container. Each item is of the following format:
|
Definition at line 1221 of file SwiftFileBackend.php.
SwiftFileBackend::storageUrl | ( | array $ | creds, |
$ | container = null , |
||
$ | object = null |
||
) | [protected] |
array | $creds | From getAuthentication() |
string | $container | |
string | $object |
Definition at line 1597 of file SwiftFileBackend.php.
array SwiftFileBackend::$authCreds [protected] |
*
Definition at line 56 of file SwiftFileBackend.php.
int SwiftFileBackend::$authErrorTimestamp = null [protected] |
UNIX timestamp *.
Definition at line 60 of file SwiftFileBackend.php.
int SwiftFileBackend::$authSessionTimestamp = 0 [protected] |
UNIX timestamp *.
Definition at line 58 of file SwiftFileBackend.php.
int SwiftFileBackend::$authTTL [protected] |
TTL in seconds *.
Definition at line 38 of file SwiftFileBackend.php.
ProcessCacheLRU SwiftFileBackend::$containerStatCache [protected] |
Container stat cache *.
Definition at line 54 of file SwiftFileBackend.php.
MultiHttpClient SwiftFileBackend::$http [protected] |
*
Definition at line 36 of file SwiftFileBackend.php.
bool SwiftFileBackend::$isRGW = false [protected] |
Whether the server is an Ceph RGW *.
Definition at line 62 of file SwiftFileBackend.php.
string SwiftFileBackend::$rgwS3AccessKey [protected] |
S3 access key (RADOS Gateway) *.
Definition at line 48 of file SwiftFileBackend.php.
string SwiftFileBackend::$rgwS3SecretKey [protected] |
S3 authentication key (RADOS Gateway) *.
Definition at line 50 of file SwiftFileBackend.php.
BagOStuff SwiftFileBackend::$srvCache [protected] |
*
Definition at line 52 of file SwiftFileBackend.php.
string SwiftFileBackend::$swiftAuthUrl [protected] |
Authentication base URL (without version) *.
Definition at line 40 of file SwiftFileBackend.php.
string SwiftFileBackend::$swiftKey [protected] |
Secret key for user *.
Definition at line 44 of file SwiftFileBackend.php.
string SwiftFileBackend::$swiftTempUrlKey [protected] |
Shared secret value for making temp URLs *.
Definition at line 46 of file SwiftFileBackend.php.
string SwiftFileBackend::$swiftUser [protected] |
Swift user (account:user) to authenticate as *.
Definition at line 42 of file SwiftFileBackend.php.