Merge branch 'release/0.4.4'

This commit is contained in:
Walter Dal Mut
2015-06-13 12:22:58 +02:00
8 changed files with 25 additions and 42 deletions
+5 -5
View File
@@ -268,8 +268,8 @@ The impact using UDP/IP or HTTP adapters
Corley\Benchmarks\InfluxDB\AdapterEvent
Method Name Iterations Average Time Ops/second
------------------------ ------------ -------------- -------------
sendDataUsingHttpAdapter: [1,000 ] [0.0162619416714] [61.49327]
sendDataUsingUdpAdapter : [1,000 ] [0.0000890662670] [11,227.59529]
sendDataUsingHttpAdapter: [1,000 ] [0.0167509446144] [59.69813]
sendDataUsingUdpAdapter : [1,000 ] [0.0000905156136] [11,047.81773]
```
### Message to inline protocol conversion
@@ -283,8 +283,8 @@ The impact of message to inline protocol conversion is:
Corley\Benchmarks\InfluxDB\MessageToInlineProtocolEvent
Method Name Iterations Average Time Ops/second
---------------------------------------------------- ------------ -------------- -------------
convertMessageToInlineProtocolWithNoTags : [10,000 ] [0.0000230122805] [43,455.05877]
convertMessageToInlineProtocolWithGlobalTags : [10,000 ] [0.0000301691532] [33,146.43911]
convertMessageToInlineProtocolWithDifferentTagLevels: [10,000 ] [0.0000327563763] [30,528.40741]
convertMessageToInlineProtocolWithNoTags : [10,000 ] [0.0000237422466] [42,119.01324]
convertMessageToInlineProtocolWithGlobalTags : [10,000 ] [0.0000306700468] [32,605.10185]
convertMessageToInlineProtocolWithDifferentTagLevels: [10,000 ] [0.0000343942404] [29,074.63543]
```
+1 -1
View File
@@ -1 +1 @@
0.4.3
0.4.4
@@ -15,23 +15,21 @@ class AdapterEvent extends AthleticEvent
public function setUp()
{
$client = new Client();
$options = new Options();
$options->setHost("localhost");
$options->setPort(8086);
$options->setUsername("root");
$options->setPassword("root");
$options->setDatabase("tcp.test");
$client->setAdapter(
new GuzzleAdapter(new HttpClient(), $options)
);
$client = new Client(new GuzzleAdapter(new HttpClient(), $options));
$this->httpClient = $client;
$opts = new Options();
$opts->setPort(4444);
$client = new Client();
$client->setAdapter(new UdpAdapter($opts));
$client = new Client(new UdpAdapter($opts));
$this->udpClient = $client;
}
+2 -7
View File
@@ -2,22 +2,17 @@
namespace InfluxDB\Adapter;
use InfluxDB\Options;
use InfluxDB\Adapter\WritableInterface;
abstract class AdapterAbstract implements AdapterInterface
abstract class AdapterAbstract implements WritableInterface
{
private $options;
/**
* @param Options $options
*/
public function __construct(Options $options)
{
$this->options = $options;
}
/**
* @return Options
*/
public function getOptions()
{
return $this->options;
-15
View File
@@ -1,15 +0,0 @@
<?php
namespace InfluxDB\Adapter;
/**
* Every InfluxDB adapter implements this interface
*/
interface AdapterInterface
{
/**
* Send series into database
* @param mixed $message
* @param string|boolean $timePrecision
*/
public function send(array $message);
}
-6
View File
@@ -4,12 +4,6 @@ namespace InfluxDB\Adapter;
use GuzzleHttp\Client;
use InfluxDB\Options;
/**
* Class GuzzleAdapter
* @package InfluxDB\Adapter
*
* @deprecated
*/
class GuzzleAdapter extends AdapterAbstract implements QueryableInterface
{
private $httpClient;
+7
View File
@@ -0,0 +1,7 @@
<?php
namespace InfluxDB\Adapter;
interface WritableInterface
{
public function send(array $message);
}
+6 -2
View File
@@ -2,6 +2,7 @@
namespace InfluxDB;
use InfluxDB\Adapter\WritableInterface;
use InfluxDb\Adapter\QueryableInterface;
/**
@@ -11,10 +12,9 @@ class Client
{
private $adapter;
public function __construct(Adapter\AdapterInterface $adapter)
public function __construct($adapter)
{
$this->adapter = $adapter;
return $this;
}
public function getAdapter()
@@ -24,6 +24,10 @@ class Client
public function mark($name, array $values = [])
{
if (!($this->getAdapter() instanceOf WritableInterface)) {
throw new \BadMethodCallException("You can write data to database only if the adapter supports it!");
}
$data = $name;
if (!is_array($name)) {
$data =[];