Permalink
Browse files

gplv3

  • Loading branch information...
1 parent 058ed9a commit fdcb5141753fbbe2b54739fb824ded9f63e7e639 @cameronjacobson committed Dec 22, 2012
View
@@ -1,6 +1,6 @@
{
"require": {
- "evenement/evenement": "2.0.*"
+ "phixd/phixd": "1.0.*@dev"
},
"autoload": {
"psr-0": {
View
Oops, something went wrong.
@@ -3,9 +3,30 @@
namespace KyotoTyphoon\Client;
use \KyotoTyphoon\Interfaces\KyotoClientInterface;
+use \KyotoTyphoon\Transport\KyotoBinaryTransport;
+
+use \KyotoTyphoon\KyotoRequest as Request;
+use \KyotoTyphoon\KyotoResponse as Response;
+
+use \KyotoTyphoon\KyotoEvent;
class KyotoBinaryClient implements KyotoClientInterface
{
+ private $transport;
+ public $emitter;
+
public function __construct(Array $options){
+ $this->transport = new KyotoBinaryTransport($options);
+ $this->emitter = new KyotoEvent();
}
+
+ public function replication(){}
+
+ public function play_script(){}
+
+ public function set_bulk(){}
+
+ public function remove_bulk(){}
+
+ public function get_bulk(){}
}
@@ -2,10 +2,29 @@
namespace KyotoTyphoon\Client;
-use KyotoTyphoon\Interfaces\KyotoClientInterface;
+use \KyotoTyphoon\Interfaces\KyotoClientInterface;
+use \KyotoTyphoon\Transport\KyotoRestTransport;
+
+use \KyotoTyphoon\KyotoRequest as Request;
+use \KyotoTyphoon\KyotoResponse as Response;
+
+use \KyotoTyphoon\KyotoEvent;
class KyotoRestClient implements KyotoClientInterface
{
+ private $transport;
+ public $emitter;
+
public function __construct(Array $options){
+ $this->transport = new KyotoBinaryTransport($options);
+ $this->emitter = new KyotoEvent();
}
+
+ public function GET(){}
+
+ public function HEAD(){}
+
+ public function PUT(){}
+
+ public function DELETE(){}
}
@@ -2,16 +2,26 @@
namespace KyotoTyphoon\Client;
-use KyotoTyphoon\Interfaces\KyotoClientInterface;
+use \KyotoTyphoon\Interfaces\KyotoClientInterface;
+use \KyotoTyphoon\Transport\KyotoRpcTransport;
+
+use \KyotoTyphoon\KyotoRequest as Request;
+use \KyotoTyphoon\KyotoResponse as Response;
+
+use \KyotoTyphoon\KyotoEvent;
class KyotoRpcClient implements KyotoClientInterface
{
private $defaultEncoding = 'B';
private $defaultContentType = 'text/tab-separated-values';
private $validContentTypes = ['text/tab-separated-values','application/x-www-form-urlencoded','query-string'];
private $validEncodings = ['base64'=>'B', 'quoted-printable'=>'Q', 'url-encoding'=>'U'];
+ private $transport;
+ public $emitter;
public function __construct(Array $options){
+ $this->transport = new KyotoRpcTransport($options);
+ KyotoEvent::emitter = new KyotoEvent();
$this->setDefaultEncoding(@$options['encoding']);
$this->setDefaultContentType(@$options['contentType']);
}
@@ -30,4 +40,206 @@ public function setDefaultContentType($contentType = ''){
$this->defaultContentType = strtolower($contentType);
}
}
+
+ public function void(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function echo(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function report(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function play_script(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function tune_replication(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function status(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function clear(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function synchronize(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function set(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function add(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function replace(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function append(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function increment(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function increment_double(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cas(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function remove(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function get(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function check(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function seize(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function set_bulk(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function remove_bulk(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function get_bulk(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function vacuum(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function match_prefix(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function match_regex(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function match_similar(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_jump(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_jump_back(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_step(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_step-back(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_set_value(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_remove(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_get_key(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_get_value(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_get(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_seize(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ public function cur_delete(Array $params=[],Array $callbacks=[]){
+ return $this->send(__METHOD__, [
+ ],$callbacks);
+ }
+
+ private function send($command,Array $options,Array $callbacks=[]){
+
+ $requestHash = spl_object_hash($request = new Request());
+ $responseHash = spl_object_hash($response = new Response());
+
+ $request->command = $command;
+ $request->options = $options
+
+ foreach($callbacks as $event=>$callback){
+ if(is_callable($callback)){
+ $this->emitter->once($event,$callback);
+ }
+ }
+
+ return $this->transport->send($request, $response);
+ }
}
@@ -29,15 +29,12 @@ public function __construct(Array $options){
$this->protocol = @strtolower($options['protocol']) ?: 'rest';
switch($this->protocol){
case 'binary':
- $this->transport = new KyotoBinaryTransport($options);
$this->client = new KyotoBinaryClient($options);
break;
case 'rpc':
- $this->transport = new KyotoRpcTransport($options);
$this->client = new KyotoRpcClient($options);
break;
default:
- $this->transport = new KyotoRestTransport($options);
$this->client = new KyotoRestClient($options);
break;
}
@@ -59,4 +56,15 @@ public function setPort($port = 0){
}
}
+ public function __call($name,$args){
+ $this->client->$name($args);
+ }
+
+ public function __get($name){
+ return $this->client->$name;
+ }
+
+ public function __set($name,$value){
+ $this->client->$name = $value;
+ }
}
@@ -2,8 +2,11 @@
namespace KyotoTyphoon;
-use \Evenement\EventEmitter;
+use \Phixd\Phixd;
-class KyotoEvent extends EventEmitter
+class KyotoEvent extends Phixd
{
+ public function __construct(){
+ parent::__construct();
+ }
}
@@ -2,35 +2,13 @@
namespace KyotoTyphoon;
+use KyotoTyphoon\KyotoEvent;
+
class KyotoRequest
{
- private $headers = array();
- private $contentLength;
-
- public setContentLength($length){
- $this->contentLength = $length;
- }
-
- private function setHeader($key, $value){
- $this->headers[$key] = $value;
- }
-
- private function removeHeader($key){
- @unset($this->headers[$key]);
- }
-
- private function initRequest(){
- $this->headers = array($action.' '.$path.' HTTP/1.0');
- $this->setHeader('Host',$this->host.':'.$this->port);
- $this->setHeader('Content-Type',$this->ctype);
- $this->setHeader('Content-Length',$this->contentLength);
- }
-
- private function doAction(){
-
- }
+ public $requestid;
- protected function send(){
-
+ public function __construct(Array $params){
+ $this->requestid = spl_object_hash($this);
}
}
Oops, something went wrong.

0 comments on commit fdcb514

Please sign in to comment.