diff --git a/README.md b/README.md index 4a35a12e1..2d5171146 100644 --- a/README.md +++ b/README.md @@ -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] ``` diff --git a/VERSION b/VERSION index 17b2ccd9b..6f2743d65 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.3 +0.4.4 diff --git a/benchmarks/Benchmarks/InfluxDB/AdapterEvent.php b/benchmarks/Benchmarks/InfluxDB/AdapterEvent.php index ba43adac0..e52604941 100644 --- a/benchmarks/Benchmarks/InfluxDB/AdapterEvent.php +++ b/benchmarks/Benchmarks/InfluxDB/AdapterEvent.php @@ -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; } diff --git a/src/Adapter/AdapterAbstract.php b/src/Adapter/AdapterAbstract.php index b03d47681..342b40bda 100644 --- a/src/Adapter/AdapterAbstract.php +++ b/src/Adapter/AdapterAbstract.php @@ -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; diff --git a/src/Adapter/AdapterInterface.php b/src/Adapter/AdapterInterface.php deleted file mode 100644 index 23bdf7a68..000000000 --- a/src/Adapter/AdapterInterface.php +++ /dev/null @@ -1,15 +0,0 @@ -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 =[];