FINAL
Google Cloud Storage Read Client - Implements only the methods required to read bytes from GCS using stream wrappers. For a fully fledged client to access Google Cloud Storage you should consult the Google API client.
CloudStorageClient provides default fail implementations for all of the methods that the stream wrapper might potentially call. Derived classes then only implement the methods that are relevant to the operations that they perform.
Constants
METADATA_HEADER_PREFIX
Prefix for all metadata headers used when parsing and rendering.
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DEFAULT_READ_SIZE
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DEFAULT_READ_CACHE_EXPIRY_SECONDS
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DEFAULT_MAXIMUM_NUMBER_OF_RETRIES
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DEFAULT_CONNECTION_TIMEOUT_SECONDS
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DEFAULT_WRITABLE_CACHE_EXPIRY_SECONDS
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
READ_SCOPE
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
WRITE_SCOPE
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
FULL_SCOPE
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
OAUTH_TOKEN_FORMAT
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
PARTIAL_CONTENT_RANGE_FORMAT
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
FINAL_CONTENT_RANGE_FORMAT
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
FINAL_CONTENT_RANGE_NO_DATA
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
DELIMITER
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
FOLDER_SUFFIX
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
WRITABLE_TEMP_FILENAME
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IFREG
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IFDIR
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IRWXU
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IRUSR
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IWUSR
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IXUSR
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IRWXG
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IRGRP
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IWGRP
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IXGRP
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IRWXO
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IROTH
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IWOTH
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
S_IXOTH
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
CONTENT_RANGE_REGEX
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
MEMCACHE_KEY_FORMAT
Memcache key format for caching the results of reads from GCS. The parameters are the object url (as a string) and the read range, as a string (e.g. bytes=0-512000).
Example key for a cloud storage file gs://bucket/object.png _ah_gs_read_cache_https://storage.googleapis.com/bucket/object.png_bytes=0-524287
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
MEMCACHE_KEY_HASH_FORMAT
Memcache key format for caching the results of reads from GCS. If the key generated using the filename and range is longer than the maximum allowed memcache key we hash down the value and use this format instead.
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
MEMCACHE_KEY_MAX_LENGTH
The maximum length of a memcache key.
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
WRITABLE_MEMCACHE_KEY_FORMAT
Memcache key format for caching the results of checking if a bucket is writable. The only way to check if an app can write to a bucket is by actually writing a file. As the ACL on a bucket is unlikely to change then we can cache the result.
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
Methods
__construct
__construct(string $bucket, string $object, resource $context)
Construct an object of CloudStorageClient.
Parameters
Name | Description |
---|---|
|
The name of the bucket. |
|
The name of the object, or null if there is no object. |
|
The stream context to use. |
__destruct
__destruct()
initialize
initialize()
dir_readdir
dir_readdir()
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
dir_rewinddir
dir_rewinddir()
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
close
close()
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
delete
delete()
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
eof
eof()
Returns true if we have read to the end of file, false otherwise.
flush
flush()
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
read
read( $count_bytes)
Read at most $count_bytes from the file.
If we have reached the end of the buffered amount, and there is more data in the file then retreive more bytes from storage.
Parameters
Name | Description |
---|---|
|
seek
seek( $offset, $whence)
Seek within the current file. We expect the upper layers of PHP to convert SEEK_CUR to SEEK_SET.
Parameters
Name | Description |
---|---|
|
|
|
stat
stat()
Return our stat buffer, if we have one.
tell
tell()
Having tell() at this level in the stack seems bonkers.
write
write( $data)
Parameters
Name | Description |
---|---|
|
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
getMetaData
getMetaData()
Subclass can override this method to return the metadata of the underlying GCS object.
getContentType
getContentType()
Subclass can override this method to return the MIME content type of the underlying GCS object.
createObjectUrl
STATIC
createObjectUrl( $bucket, $object = null)
Create a URL for a target bucket and optional object.
Parameters
Name | Description |
---|---|
|
|
|
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
clearStatCache
STATIC
clearStatCache(string $filename = null)
Clear the stat cache.
Parameters
Name | Description |
---|---|
|
Option filename to clear from the cache. |
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient
getReadMemcacheKey
STATIC
getReadMemcacheKey(string $url, string $range) : string
Create a memcache key for the read data cache. If the filename is long enough that the key would exceed memcache limits, then a hash of the filename and the range is used to generate the key.
We prefer the human readable key format where possible so users can easily identify which files and segments are stored in memcache.
Parameters
Name | Description |
---|---|
|
The url of the file that contains the data being cached. |
|
The range oheader f the data being cached. |
Returns
string
The memcache key to use for storing data.
Inherited from
\google\appengine\ext\cloud_storage_streams\CloudStorageClient