Permalink
Browse files

More documentation and random cleanup

  • Loading branch information...
1 parent 1ec088d commit 38220be9dbc8fa2eb5079a584b2cf97de1cfc8ac @sebgiroux committed Jan 14, 2012
Showing with 153 additions and 18 deletions.
  1. +1 −1 columnfamily_action.php
  2. +3 −3 counters.php
  3. +2 −2 describe_columnfamily.php
  4. +2 −2 describe_keyspace.php
  5. +11 −0 helper/ClusterHelper.php
  6. +16 −0 helper/ColumnFamilyHelper.php
  7. +118 −10 helper/MX4J.php
@@ -664,7 +664,7 @@
$vw_vars['current_offset_key'] = $offset_key;
- if ($offset_key == '') {
+ if (empty($offset_key)) {
$_SESSION['browse_data_offset_key'] = array();
$_SESSION['browse_data_offset_key'][] = '';
}
View
@@ -22,11 +22,11 @@
echo getHTML('header.php');
// Make sure a keyspace name has been specified
- if ($keyspace_name == '') {
+ if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
- if ($columnfamily_name == '') {
+ if (empty($columnfamily_name)) {
echo displayErrorMessage('columnfamily_name_must_be_specified');
}
else {
@@ -44,7 +44,7 @@
}
// Error
- if (isset($_GET['error']) == 1) {
+ if (isset($_GET['error'])) {
$vw_vars['error_message'] = displayErrorMessage('something_wrong_happened',array('message' => $_SESSION['message']));
}
@@ -24,11 +24,11 @@
echo getHTML('header.php');
// Make sure a keyspace name has been specified
- if ($keyspace_name == '') {
+ if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
- if ($columnfamily_name == '') {
+ if (empty($columnfamily_name)) {
echo displayErrorMessage('columnfamily_name_must_be_specified');
}
else {
@@ -19,7 +19,7 @@
$vw_vars = array();
- if ($keyspace_name == '') {
+ if (empty($keyspace_name)) {
echo displayErrorMessage('keyspace_name_must_be_specified');
}
else {
@@ -28,7 +28,7 @@
// CF created successfully
$vw_vars['added_cf'] = '';
- if (isset($_GET['create_cf']) == 1) {
+ if (isset($_GET['create_cf'])) {
$columnfamily_name = $_SESSION['message'];
$query_time = $_SESSION['query_time'];
$vw_vars['added_cf'] = displaySuccessMessage('create_columnfamily',array('columnfamily_name' => $columnfamily_name,'query_time' => $query_time));
@@ -11,6 +11,11 @@
class ClusterHelper {
private $cassandra_clusters = array();
+ /*
+ Constructor
+
+ @param $cassandra_clusters The array of Cassandra nodes to manage
+ */
public function __construct($cassandra_clusters) {
$this->cassandra_clusters = $cassandra_clusters;
}
@@ -28,6 +33,8 @@ public function getClusterIndex() {
/*
Get the name of the cluster at $index
+
+ @param $index Index of the cluster name to get
*/
public function getClusterNameForIndex($index) {
try {
@@ -54,6 +61,8 @@ public function getArrayOfNodesForCurrentCluster() {
/*
Get a random Cassandra node at $index
+
+ @param $index Index of the cluster to get a random node from
*/
public function getRandomNodeForIndex($index) {
$all_nodes = $this->cassandra_clusters[$index]['nodes'];
@@ -71,6 +80,8 @@ public function getRandomNodeForCurrentCluster() {
/*
Get the Cassandra cluster credentials at $index
+
+ @param $index Get the specified credentials for the cluster at the specified index
*/
public function getCredentialsForIndex($index) {
$cluster = $this->cassandra_clusters[$index];
@@ -11,6 +11,9 @@
class ColumnFamilyHelper {
/*
Return the column family definition for the specified keyspace name and column family name
+
+ @param $keyspace_name The keyspace name that the column family is in
+ @param $columnfamily_name The column family name to get
*/
public static function getCFInKeyspace($keyspace_name,$columnfamily_name) {
global $sys_manager;
@@ -66,6 +69,13 @@ public static function getKeyspacesAndColumnFamiliesDetails() {
/*
Display a row out of a column family
+
+ @param $row_key The key of the row to display
+ @param $keyspace_name The keyspace name that row was in
+ @param $columnfamily_name The column family name that row was in
+ @param $row The complete row
+ @param $scf_key The key of the super column family, if it apply
+ @param $is_counter_column True if the column family is a counter column, false otherwise
*/
public static function displayCFRow($row_key,$keyspace_name,$columnfamily_name,$row,$scf_key = null,$is_counter_column = false) {
$vw_vars['scf_key'] = $scf_key;
@@ -85,6 +95,12 @@ public static function displayCFRow($row_key,$keyspace_name,$columnfamily_name,$
/*
Display a row out of a super column family
+
+ @param $row_key The key of the row to display
+ @param $keyspace_name The keyspace name that row was in
+ @param $columnfamily_name The column family name that row was in
+ @param $row The complete row
+ @param $is_counter_column True if the column family is a counter column, false otherwise
*/
public static function displaySCFRow($row_key,$keyspace_name,$columnfamily_name,$row,$is_counter_column = false) {
$output = '';
Oops, something went wrong.

0 comments on commit 38220be

Please sign in to comment.