HPCloud-PHP  1.2.0
PHP bindings for HPCloud and OpenStack services.
 All Classes Namespaces Files Functions Variables Pages
StreamWrapperFS Class Reference

Provides stream wrapping for Swift like a file system. More...

Inheritance diagram for StreamWrapperFS:
StreamWrapper

Public Member Functions

 mkdir ($uri, $mode, $options)
 Fake a make a dir.
 rmdir ($path, $options)
 Fake Remove a directory.
 url_stat ($path, $flags)
- Public Member Functions inherited from StreamWrapper
 dir_closedir ()
 Close a directory.
 dir_opendir ($path, $options)
 Open a directory for reading.
 dir_readdir ()
 Read an entry from the directory.
 dir_rewinddir ()
 Rewind to the beginning of the listing.
 rename ($path_from, $path_to)
 Rename a swift object.
 stream_cast ($cast_as)
 Cast stream into a lower-level stream.
 stream_close ()
 Close a stream, writing if necessary.
 stream_eof ()
 Check whether the stream has reached its end.
 stream_flush ()
 Initiate saving data on the remote object storage.
 stream_open ($path, $mode, $options, &$opened_path)
 Open a stream resource.
 stream_read ($count)
 Read N bytes from the stream.
 stream_seek ($offset, $whence)
 Perform a seek.
 stream_set_option ($option, $arg1, $arg2)
 Set options on the underlying stream.
 stream_stat ()
 Perform stat()/lstat() operations.
 stream_tell ()
 Get the current position in the stream.
 stream_write ($data)
 Write data to stream.
 unlink ($path)
 Unlink a file.
 object ()
 Get the Object.
 objectStorage ()
 EXPERT: Get the ObjectStorage for this wrapper.
 token ()
 EXPERT: Get the auth token for this wrapper.
 serviceCatalog ()
 EXPERT: Get the service catalog (IdentityServices) for this wrapper.

Public Attributes

const DEFAULT_SCHEME = 'swiftfs'
- Public Attributes inherited from StreamWrapper
const DEFAULT_SCHEME = 'swift'
 $context
 The stream context.

Protected Member Functions

 testDirectoryExists ($path)
 Test if a path prefix (directory like) esits.
 fakeStat ($dir=FALSE)
 Fake stat data.
- Protected Member Functions inherited from StreamWrapper
 writeRemote ()
 Write data to the remote object storage.
 generateStat ($object, $container, $size)
 Generate a reasonably accurate STAT array.
 setMode ($mode)
 Set the fopen mode.
 cxt ($name, $default=NULL)
 Get an item out of the context.
 parseUrl ($url)
 Parse a URL.
 initializeObjectStorage ()
 Based on the context, initialize the ObjectStorage.
 initializeCDN ($token, $catalog)
 Initialize CDN service.
 authenticate ()

Protected Attributes

 $schemeName = self::DEFAULT_SCHEME
- Protected Attributes inherited from StreamWrapper
 $contextArray = array()
 $schemeName = self::DEFAULT_SCHEME
 $authToken
 $isBinary = FALSE
 $isText = TRUE
 $isWriting = FALSE
 $isReading = FALSE
 $isTruncating = FALSE
 $isAppending = FALSE
 $noOverwrite = FALSE
 $createIfNotFound = TRUE
 $isNeverDirty = FALSE
 If this is TRUE, no data is ever sent to the remote server.
 $triggerErrors = FALSE
 $isDirty = FALSE
 Indicate whether the local differs from remote.
 $store
 Object storage instance.
 $container
 The Container.
 $obj
 The Object.
 $objStream
 The IO stream for the Object.
 $dirListing = array()
 Directory listing.
 $dirIndex = 0
 $dirPrefix = ''

Additional Inherited Members

- Static Protected Attributes inherited from StreamWrapper
static $serviceCatalogCache = array()
 Cache of auth token -> service catalog.

Detailed Description

Provides stream wrapping for Swift like a file system.

This provides a full stream wrapper to expose swiftfs:// URLs to the PHP stream system.

See Also
http://us3.php.net/manual/en/class.streamwrapper.php

Definition at line 81 of file StreamWrapperFS.php.

Member Function Documentation

fakeStat (   $dir = FALSE)
protected

Fake stat data.

Under certain conditions we have to return totally trumped-up stats. This generates those.

Definition at line 193 of file StreamWrapperFS.php.

References StreamWrapper\cxt().

Referenced by StreamWrapperFS\url_stat().

mkdir (   $uri,
  $mode,
  $options 
)

Fake a make a dir.

ObjectStorage has pathy objects not directories. If no objects with a path prefix exist we can pass creating a directory. If objects with a path prefix exist adding the directory will fail.

Definition at line 93 of file StreamWrapperFS.php.

References StreamWrapper\cxt(), and StreamWrapperFS\testDirectoryExists().

rmdir (   $path,
  $options 
)

Fake Remove a directory.

ObjectStorage has pathy objects not directories. If no objects with a path prefix exist we can pass removing it. If objects with a path prefix exist removing the directory will fail.

Definition at line 106 of file StreamWrapperFS.php.

References StreamWrapperFS\testDirectoryExists().

testDirectoryExists (   $path)
protected

Test if a path prefix (directory like) esits.

ObjectStorage has pathy objects not directories. If objects exist with a path prefix we can consider that the directory exists. For example, if we have an object at foo/bar/baz.txt and test the existance of the directory foo/bar/ we sould see it.

Parameters
string$pathThe directory path to test.
Return values
boolean
Returns
boolean TRUE if the directory prefix exists and FALSE otherwise.

Definition at line 155 of file StreamWrapperFS.php.

References $container, StreamWrapper\$dirListing, ObjectStorage\$url, StreamWrapper\initializeObjectStorage(), and StreamWrapper\parseUrl().

Referenced by StreamWrapperFS\mkdir(), StreamWrapperFS\rmdir(), and StreamWrapperFS\url_stat().

url_stat (   $path,
  $flags 
)
See Also
stream_stat().

Reimplemented from StreamWrapper.

Definition at line 115 of file StreamWrapperFS.php.

References StreamWrapper\cxt(), StreamWrapperFS\fakeStat(), and StreamWrapperFS\testDirectoryExists().

Member Data Documentation

$schemeName = self::DEFAULT_SCHEME
protected

Definition at line 84 of file StreamWrapperFS.php.

const DEFAULT_SCHEME = 'swiftfs'

Definition at line 83 of file StreamWrapperFS.php.


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