Objects are the fundamental component of the Object Storage service. An "object" can be an image, a movie, a file, or anything else that has bits and requires a place to be stored.
Unfortunately, the term object has a very specific meaning in
terms of computer programming, and it can be rather confusing to
have multiple things carry the same "object" moniker. Thus,
php-opencloud refers to an object stored in the object storage
service as a DataObject. This is purely to avoid confusion—for
example, the built-in PHP function is_object() checks to see
whether its argument is a PHP object, not if it's stored in the
ObjectStore.
Thus, the complete hierarchy for the object storage service is:
OpenStack(orRackspace) is the parent ofObjectStoreservice instance, which is the parent ofContainer, which is the parent ofDataObject, which holds the actual object data
You create an (empty) DataObject by calling the factory method
on a Container object:
$cloud = new OpenStack(...);
$ostore = $cloud->ObjectStore(...);
$container = $ostore->Container('MyContainer');
$obj = $container->DataObject();
These are the standard attributes defined on a DataObject:
name- name of the objecthash- MD5 checksum of the objectbytes- size of the object in byteslast_modified- date and time the object was last modifiedcontent_type- a Content-Type identifiercontent_length- content length (should be the same as bytes)
These are the available methods (examples are below):
Url()- the URL of the object in the storage systemCreate()- creates a new object in the object storage systemUpdate()- updates an existing objectDelete()- deletes an objectSetData()- sets the content of the object directly (rarely used)SaveToString()- returns the object as a string (rarely used)SaveToFilename()- saves the stored object to a local file
It is not uncommon for objects stored in the object storage service to me much large that the available memory on the server. For example, the server may only have a few gigabytes of memory, but a stored video file may be 100GB in size. Thus, the objects' data is typically read from (or written to) files in the local filesystem. This is not always the case, of course, so other methods are provided, but they are marked as (rarely used) in the list above.
Return to the Table of Contents