App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Public Member Functions | Protected Member Functions | List of all members
google\appengine\ext\cloud_storage_streams\CloudStorageReadClient Class Reference
Inheritance diagram for google\appengine\ext\cloud_storage_streams\CloudStorageReadClient:
google\appengine\ext\cloud_storage_streams\CloudStorageClient

Public Member Functions

 __construct ($bucket, $object, $context)
 
 initialize ()
 
 read ($count_bytes)
 
 eof ()
 
 seek ($offset, $whence)
 
 stat ()
 
 tell ()
 
 getMetaData ()
 
 getContentType ()
 
- Public Member Functions inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
 __construct ($bucket, $object=null, $context=null)
 
 initialize ()
 
 dir_readdir ()
 
 dir_rewinddir ()
 
 close ()
 
 delete ()
 
 eof ()
 
 flush ()
 
 read ($count_bytes)
 
 seek ($offset, $whence)
 
 stat ()
 
 tell ()
 
 write ($data)
 
 getMetaData ()
 
 getContentType ()
 

Protected Member Functions

 makeHttpRequest ($url, $method, $headers, $body=null)
 
- Protected Member Functions inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
 getOAuthTokenHeader ($scopes)
 
 getRangeHeader ($start_byte, $end_byte)
 
 makeHttpRequest ($url, $method, $headers, $body=null)
 
 getHeaderValue ($header_name, $headers)
 
 createStatArray ($stat_args)
 
 tryParseCloudStorageErrorMessage ($gcs_result, &$code, &$message)
 
 getErrorMessage ($http_status_code, $http_result, $msg_prefix="Cloud Storage Error:")
 

Additional Inherited Members

- Static Public Member Functions inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
static createObjectUrl ($bucket, $object=null)
 
- Public Attributes inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
const METADATA_HEADER_PREFIX = 'x-goog-meta-'
 
const DEFAULT_READ_SIZE = 524288
 
const DEFAULT_READ_CACHE_EXPIRY_SECONDS = 3600
 
const DEFAULT_MAXIMUM_NUMBER_OF_RETRIES = 2
 
const DEFAULT_WRITABLE_CACHE_EXPIRY_SECONDS = 600
 
const READ_SCOPE = "https://www.googleapis.com/auth/devstorage.read_only"
 
const WRITE_SCOPE = "https://www.googleapis.com/auth/devstorage.read_write"
 
const FULL_SCOPE = "https://www.googleapis.com/auth/devstorage.full_control"
 
const OAUTH_TOKEN_FORMAT = "OAuth %s"
 
const PARTIAL_CONTENT_RANGE_FORMAT = "bytes %d-%d/*"
 
const FINAL_CONTENT_RANGE_FORMAT = "bytes %d-%d/%d"
 
const FINAL_CONTENT_RANGE_NO_DATA = "bytes */%d"
 
const DELIMITER = '/'
 
const FOLDER_SUFFIX = '_$folder$'
 
const WRITABLE_TEMP_FILENAME = "/_ah_is_writable_temp_file"
 
const S_IFREG = 0100000
 
const S_IFDIR = 0040000
 
const S_IRWXU = 00700
 
const S_IRUSR = 00400
 
const S_IWUSR = 00200
 
const S_IXUSR = 00100
 
const S_IRWXG = 00070
 
const S_IRGRP = 00040
 
const S_IWGRP = 00020
 
const S_IXGRP = 00010
 
const S_IRWXO = 00007
 
const S_IROTH = 00004
 
const S_IWOTH = 00002
 
const S_IXOTH = 00001
 
const CONTENT_RANGE_REGEX = "/bytes\s+(\d+)-(\d+)\/(\d+)/i"
 
const MEMCACHE_KEY_FORMAT = "_ah_gs_read_cache_%s_%s"
 
const WRITABLE_MEMCACHE_KEY_FORMAT = "_ah_gs_write_bucket_cache_%s"
 
- Static Public Attributes inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
static POST
 
static enable_optimistic_cache
 
- Static Protected Member Functions inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
static extractMetaData (array $headers)
 
- Protected Attributes inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
 $bucket_name
 
 $object_name
 
 $context_options = []
 
 $url
 
 $anonymous
 
- Static Protected Attributes inherited from google\appengine\ext\cloud_storage_streams\CloudStorageClient
static $METADATA_HEADERS
 
static $retry_error_codes
 
static $retry_exception_codes
 
static $valid_acl_values
 
static $upload_start_header = ["x-goog-resumable" => "start"]
 

Detailed Description

Google Cloud Storage Client for reading objects.

Member Function Documentation

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::eof ( )

Returns true if we have read to the end of file, false otherwise.

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::makeHttpRequest (   $url,
  $method,
  $headers,
  $body = null 
)
protected

Override the makeHttpRequest function so we can implement caching. If caching is enabled then we try and retrieve a matching request for the object name and range from memcache. If we find a result in memcache, and optimistic caching is enabled then we return that result immediately without checking if the object has changed in GCS. Otherwise, we will issue a 'If-None-Match' request with the ETag of the object to ensure it is still current.

Optimisitic caching is best suited when the application is soley updating objects in cloud storage, as the cache can be invalidated when the object is updated by the application.

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::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.

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::seek (   $offset,
  $whence 
)

Seek within the current file. We expect the upper layers of PHP to convert SEEK_CUR to SEEK_SET.

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::stat ( )

Return our stat buffer, if we have one.

google\appengine\ext\cloud_storage_streams\CloudStorageReadClient::tell ( )

Having tell() at this level in the stack seems bonkers.


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