Skip to content

Commit

Permalink
Merge pull request #101 from basho/clientid
Browse files Browse the repository at this point in the history
Obsolete client id code.
  • Loading branch information
christophermancini committed May 29, 2015
2 parents d1bc20d + 4b3fdc5 commit eebe15c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
19 changes: 1 addition & 18 deletions src/Riak.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ class Riak
'max_connect_attempts' => 3,
];

/**
* Unique id for this client connection
*
* @var string
*/
protected $clientId = '';

/**
* The actively connected Riak Node from the ring
*
Expand All @@ -99,8 +92,6 @@ class Riak
*/
public function __construct(array $nodes, array $config = [], Api $api = NULL)
{
$this->clientId = 'php_' . base_convert(mt_rand(), 10, 36);

// wash any custom keys if any
$this->nodes = array_values($nodes);
$this->setActiveNodeIndex($this->pickNode());
Expand All @@ -114,7 +105,7 @@ public function __construct(array $nodes, array $config = [], Api $api = NULL)
$this->api = $api;
} else {
// default to HTTP bridge class
$this->api = new Http($this->getClientID(), $this->config);
$this->api = new Http($this->config);
}
}

Expand Down Expand Up @@ -165,14 +156,6 @@ public function getConfigValue($key)
return $this->config[$key];
}

/**
* @return string
*/
public function getClientID()
{
return $this->clientId;
}

/**
* @return array
*/
Expand Down
13 changes: 1 addition & 12 deletions src/Riak/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,14 @@ abstract class Api
*/
protected $node = null;

protected $clientId = '';

protected $success = null;

protected $error = '';

protected $config = [];

public function __construct($clientId, array $config = [])
public function __construct(array $config = [])
{
$this->clientId = $clientId;
$this->config = $config;
}

Expand All @@ -91,14 +88,6 @@ public function getError()
return $this->error;
}

/**
* @return string
*/
public function getClientId()
{
return $this->clientId;
}

/**
* @return int
*/
Expand Down
12 changes: 0 additions & 12 deletions tests/unit/RiakTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ public function testNodeCount($nodes)
$this->assertEquals(count($riak->getNodes()), count($nodes));
}

/**
* @dataProvider getCluster
*
* @param $nodes array
*/
public function testClientId($nodes)
{
$riak = new Riak($nodes);
$this->assertNotEmpty($riak->getClientID());
$this->assertRegExp('/^php_([a-z0-9])+$/', $riak->getClientID());
}

/**
* @dataProvider getCluster
*
Expand Down

0 comments on commit eebe15c

Please sign in to comment.