Permalink
Browse files

0.5.0 compatability testing, + fixes

  • Loading branch information...
1 parent c800528 commit 5f097619a421a49c3691b49403844303b0b15ddd @mjpearson committed Jan 26, 2010
View
@@ -16,7 +16,7 @@
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
// Config xml path for Cassandra
-define('CASSANDRA_CONF_PATH', '/usr/local/src/apache-cassandra-incubating-0.4.0/conf/storage-conf.xml');
+define('CASSANDRA_CONF_PATH', '/usr/local/src/apache-cassandra-incubating-0.5.0/conf/storage-conf.xml');
// Default Thrift port
define('PANDRA_PORT_DEFAULT', 9160);
@@ -175,6 +175,7 @@ public function addColumn($colName, $typeDef = array(), $callbackOnSave = NULL)
* @return PandraColumn
*/
public function getColumn($colName) {
+
if ($this->_gsMutable($colName)) {
return $this->_columns[$colName];
}
@@ -193,6 +194,7 @@ public function setColumn($colName, $value, $validate = TRUE) {
$this->_columns[$colName] = $value;
return;
}
+
return (array_key_exists($colName, $this->_columns) && $this->_columns[$colName]->setValue($value, $validate));
}
@@ -77,7 +77,7 @@ public function load($keyID, $colAutoCreate = PANDRA_DEFAULT_CREATE_MODE, $consi
$this->_loaded = FALSE;
- $result = Pandra::getCFSlice($keyID, $this->getKeySpace(), $this->getName(), NULL, $consistencyLevel);
+ $result = Pandra::getCFSlice($keyID, $this->getKeySpace(), $this->getName(), NULL, Pandra::getConsistency($consistencyLevel));
if ($result !== NULL) {
$this->init();
@@ -26,7 +26,7 @@
*/
public function addSuper(PandraSuperColumn $scObj) {
- $superName = $scObj->name;
+ $superName = $scObj->getName();
$scObj->setParentCF($this);
$this->_columns[$superName] = $scObj;
View
@@ -9,15 +9,6 @@
*/
class Pandra {
- /*
- const FORMAT_OBJ = 1;
- const FORMAT_ASSOC = 2;
- const FORMAT_XML = 3;
- const FORMAT_JSON = 4;
-
- const APC_EXPIRE_SECONDS = 60;
- */
-
static public $lastError = '';
static private $_consistencyLevel = PANDRA_DEFAULT_CONSISTENCY;
@@ -142,8 +133,8 @@ static public function getClient($writeMode = FALSE) {
if (empty(self::$_activeNode)) throw new Exception('Not Connected');
$useMode = ($writeMode) ? self::$writeMode : self::$readMode;
switch ($useMode) {
- case PANDRA_MODE_ROUND_APC :
// @todo, APC store of activeNode
+ case PANDRA_MODE_ROUND_APC :
case PANDRA_MODE_ROUND :
if (!current(self::$_nodeConns)) reset(self::$_nodeConns);
$curConn = each(self::$_nodeConns);
@@ -167,10 +158,13 @@ static public function getKeyspace($keySpace) {
}
static public function getConsistency($override = NULL) {
+ $consistency = self::$_consistencyLevel;
if ($override !== NULL) {
- return $override;
+ $consistency = $override;
}
- return self::$_consistencyLevel;
+
+ return $consistency;
+
}
static public function setConsistency(int $consistencyLevel) {
@@ -262,40 +256,21 @@ public function getCFSlice($keyID, $keySpace, $cfName, $superName = NULL, $consi
return NULL;
}
+ /**
+ * Grabs locally defined columnfamilies (debug tool)
+ */
+ static public function getConfColumnFamilies() {
-
-
-
- /*
- static public function buildModels($ks = NULL) {
$conf = self::loadConfigXML();
- foreach ($conf->Keyspaces as $keySpace) {
-
- var_dump($keySpace);
+ $columnFamiles = array();
+ foreach ($conf->Keyspaces as $keySpace) {
$ksName = $keySpace->attributes()->Name;
- var_dump($ksName);
-
- $columnFamilies = $keySpace->xpath('Keyspace/ColumnFamily');
- var_dump($columnFamilies);
-
- // var_dump($keySpace);
+ $columnFamilies[] = $keySpace->xpath('Keyspace/ColumnFamily');
}
+ return $columnFamiles;
}
-
- static public function toJSON(&$results) {
- }
-
- static public function toXML(&$results) {
- }
-
- static public function toSerialised(&$results) {
- }
-
- static public function toArray(&$results) {
- }
- */
}
?>
View
@@ -112,13 +112,11 @@ public function testGetKeyspace() {
$this->assertTrue(is_array($ks) && !empty($ks));
// While we don't care about the individual ColumnFamilies, we should
- // at least be able to pull out their basic attributes
- $expectedKeys = array('FlushPeriodInMinutes', 'Type', 'Desc');
+ // at least be able to pull out the default Standard1 CF Cassandra rolls out with
+ $expectedKeys = array('CompareWith', 'Type', 'Desc');
+ $diff = array_diff($expectedKeys, array_keys($ks['Standard1']));
- foreach ($ks as $columnFamily => $attributes) {
- $diff = array_diff($expectedKeys, array_keys($attributes ));
- $this->assertTrue(empty($diff));
- }
+ $this->assertTrue(empty($diff));
}
/**
Oops, something went wrong.

0 comments on commit 5f09761

Please sign in to comment.