Skip to content

Commit

Permalink
merge Protocol class into Request\Request
Browse files Browse the repository at this point in the history
  • Loading branch information
shen2 committed Aug 31, 2014
1 parent b18c035 commit 708a1eb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cassandra/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function prepare($cql) {
* @param int $consistency
* @param int $serialConsistency
*/
public function exec($cql, array $values = [], $consistency = Protocol::CONSISTENCY_QUORUM, $serialConsistency = null){
public function exec($cql, array $values = [], $consistency = Request\Request::CONSISTENCY_QUORUM, $serialConsistency = null){
if ($this->connection === null)
$this->connect();

Expand Down Expand Up @@ -266,7 +266,7 @@ public function setKeyspace($keyspace) {
if ($this->connection === null)
return;

socket_write($this->connection, new Request\Query("USE {$this->keyspace};", Protocol::CONSISTENCY_QUORUM, null));
socket_write($this->connection, new Request\Query("USE {$this->keyspace};", Request\Request::CONSISTENCY_QUORUM, null));

$response = $this->getResponse();

Expand Down
16 changes: 0 additions & 16 deletions Cassandra/Protocol.php

This file was deleted.

2 changes: 1 addition & 1 deletion Cassandra/Request/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Batch extends Request{
*/
protected $_connection;

public function __construct($type = Batch::TYPE_LOGGED, $consistency = Protocol::CONSISTENCY_QUORUM, $serialConsistency = null) {
public function __construct($type = Batch::TYPE_LOGGED, $consistency = Request::CONSISTENCY_QUORUM, $serialConsistency = null) {
$this->_batchType = $type;
$this->_consistency = $consistency;
$this->_serialConsistency = $serialConsistency;
Expand Down
12 changes: 12 additions & 0 deletions Cassandra/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@

class Request implements Frame{

const CONSISTENCY_ANY = 0x0000;
const CONSISTENCY_ONE = 0x0001;
const CONSISTENCY_TWO = 0x0002;
const CONSISTENCY_THREE = 0x0003;
const CONSISTENCY_QUORUM = 0x0004;
const CONSISTENCY_ALL = 0x0005;
const CONSISTENCY_LOCAL_QUORUM = 0x0006;
const CONSISTENCY_EACH_QUORUM = 0x0007;
const CONSISTENCY_SERIAL = 0x0008;
const CONSISTENCY_LOCAL_SERIAL = 0x0009;
const CONSISTENCY_LOCAL_ONE = 0x000A;

/**
* @var int
*/
Expand Down

0 comments on commit 708a1eb

Please sign in to comment.