Added by Justin Plock, last edited by Alexander Veremyev on Jun 02, 2008  (view change)

Labels

 
(None)

Zend Framework: Zend_Service_Amazon_S3 Component Proposal

Proposed Component Name Zend_Service_Amazon_S3
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Service_Amazon_S3
Proposers Justin Plock
Alexander Veremyev (Zend liaison)
Revision 1.0 - 10 March 2008: Initial revision. (wiki revision: 8)

Table of Contents

1. Overview

Zend_Service_Amazon_S3 is an implementation of a PHP user-stream wrapper for Amazon's Simple Storage Service (S3)

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will implement the Amazon S3 API
  • This component will use Zend_Http_Client to communicate with S3
  • This component will implement a user-based stream wrapper for S3 (s3://)

4. Dependencies on Other Framework Components

  • Zend_Http_Client

5. Theory of Operation

This component will be utilized using the stream_wrapper_register() PHP method to register a new user-based stream interface to S3. This allows the user to utilize existing fread(), fwrite(), fclose(), mkdir(), rmdir(), and stat() methods to directly interface with S3 buckets and objects.

6. Milestones / Tasks

  • Milestone 1: [DONE] Design notes will be published here
  • Milestone 2: Working prototype checked into the incubator supporting use cases
  • Milestone 3: Unit tests exist, work, and are checked into SVN.
  • Milestone 4: Initial documentation exists.

7. Class Index

  • Zend_Service_Amazon_S3

8. Use Cases

UC-01

9. Class Skeletons

At some point, I'd like to take out the kind of hacky self::$debug stuff and integrate with Zend_Log. I just found it useful to see how the stream was actually being called to help with building the methods. This class attempts to support GET Ranges as well because user-based streams limit to 8192 bytes being returned, even though it seemed Amazon was returning the full object size and ignoring my Range headers. Not too sure what was going on, but the class works regardless.

+1 (great work!)

Zend Comments

This proposal has been approved for laboratory development with the following suggestion:

  • Watch use of static members, underscores in variable names and class members, hardcoded behavior for mime-type detection based on filename, opportunity for generalized filesystem storage component (e.g., with Nirvanix and S3 as available backends), and integration with Zend_Log.

Once Zend_Mime becomes available, I'd like to replace my getMimeType() method with something from that. I've changed all of the variable names to be camelCase. I'm not quite sure how we would generalize this as a filesystem storage component considering it's intended usage is as a PHP stream wrapper. Unless a large portion of it is made static, it's sort of meant to be a standalone class. What are your thoughts? How do I migrate this class from the laboratory to the standard incubator? Thanks.