Added framed-out core.
This commit is contained in:
8
src/HPCloud.php
Normal file
8
src/HPCloud.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* HP Cloud configuration.
|
||||
*
|
||||
* This file contains the HP Cloud autoloader. It also automatically
|
||||
* register the HPCloud stream wrappers.
|
||||
*/
|
||||
0
src/HPCloud/Services/Control.php
Normal file
0
src/HPCloud/Services/Control.php
Normal file
16
src/HPCloud/Storage/Object.php
Normal file
16
src/HPCloud/Storage/Object.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* The main Object Storage driver.
|
||||
*/
|
||||
|
||||
namespace HPCloud\Storage;
|
||||
|
||||
/**
|
||||
* Object storage.
|
||||
*/
|
||||
class Object {
|
||||
public function __construct() {
|
||||
// code...
|
||||
}
|
||||
}
|
||||
57
src/HPCloud/Transport.php
Normal file
57
src/HPCloud/Transport.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* The Transport class.
|
||||
*/
|
||||
namespace HPCloud;
|
||||
/**
|
||||
* Provide underlying transportation logic.
|
||||
*
|
||||
* Interaction with the OpenStack/HPCloud services is handled via
|
||||
* HTTPS/REST requests. This class provides transport for requests, with
|
||||
* a simple and abstracted interface for issuing requests and processing
|
||||
* results.
|
||||
*
|
||||
*/
|
||||
class Transport {
|
||||
|
||||
/**
|
||||
* Construct a new transport.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
// Need to know what transporter we're using.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an HTTP GET request.
|
||||
*/
|
||||
public function doGet() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an HTTP POST request.
|
||||
*/
|
||||
public function doPost() {
|
||||
}
|
||||
/**
|
||||
* Handle an HTTP PUT request.
|
||||
*/
|
||||
public function doPut() {
|
||||
}
|
||||
/**
|
||||
* Handle an HTTP DELETE request.
|
||||
*/
|
||||
public function doDelete() {
|
||||
}
|
||||
/**
|
||||
* Handle an HTTP HEAD request.
|
||||
*/
|
||||
public function doHead() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Farm transport encoding to a separate class?
|
||||
// class TransportEncoder{}
|
||||
18
src/HPCloud/Transport/CURLTransport.php
Normal file
18
src/HPCloud/Transport/CURLTransport.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Implements a transporter with CURL.
|
||||
*/
|
||||
|
||||
namespace HPCloud\Transport;
|
||||
|
||||
/**
|
||||
* Provide HTTP transport with CURL.
|
||||
*/
|
||||
class CURLTransport implements Transporter {
|
||||
|
||||
public function doRequest($uri, $method = 'GET', $headers = array(), $body = '') {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
18
src/HPCloud/Transport/PHPStreamTransport.php
Normal file
18
src/HPCloud/Transport/PHPStreamTransport.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Implements a transporter with the PHP HTTP Stream Wrapper.
|
||||
*/
|
||||
|
||||
namespace HPCloud\Transport;
|
||||
|
||||
/**
|
||||
* Provide HTTP transport with the PHP HTTP stream wrapper.
|
||||
*/
|
||||
class PHPStreamTransport implements Transporter {
|
||||
|
||||
public function doRequest($uri, $method = 'GET', $headers = array(), $body = '') {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
39
src/HPCloud/Transport/Transporter.php
Normal file
39
src/HPCloud/Transport/Transporter.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* This file contains the interface for transporters.
|
||||
*/
|
||||
|
||||
namespace HPCloud\Transport;
|
||||
|
||||
/**
|
||||
* Describes a Transporter.
|
||||
*
|
||||
* Transporters are responsible for moving data from the remote cloud to
|
||||
* the local host. Transporters are responsible only for the transport
|
||||
* protocol, not for the payloads.
|
||||
*
|
||||
* The current OpenStack services implementation is oriented toward
|
||||
* REST-based services, and consequently the transport layers are
|
||||
* HTTP/HTTPS, and perhaps SPDY some day. The interface reflects this.
|
||||
* it is not designed as a protocol-neutral transport layer
|
||||
*/
|
||||
interface Transporter {
|
||||
|
||||
/**
|
||||
* Perform a request.
|
||||
*
|
||||
* Invoking this method causes a single request to be relayed over the
|
||||
* transporter. The transporter MUST be capable of handling multiple
|
||||
* invocations of a doRequest() call.
|
||||
*
|
||||
* @param string $uri
|
||||
* The target URI.
|
||||
* @param string $method
|
||||
* The method to be sent.
|
||||
* @param array $headers
|
||||
* An array of name/value header pairs.
|
||||
* @param string $body
|
||||
* The string containing the request body.
|
||||
*/
|
||||
public function doRequest($uri, $method = 'GET' $headers = array(), $body = '');
|
||||
}
|
||||
Reference in New Issue
Block a user